View difference between Paste ID: Ci6CsL0E and ZHyEYbuK
SHOW: | | - or go back to the newest paste.
1
-- Created by 129K
2
local animations = {
3
        requip = {
4
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
5
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-15)) * CFrame.new(1.5, -.5, 0);
6
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(210), 0, math.rad(-40)) * CFrame.new(1.5, -.5, 0);
7
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
8
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
9
        };
10
        lequip = {
11
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
12
        };
13
        runequip = {
14
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
15
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-15)) * CFrame.new(1.5, -.5, 0);
16
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(210), 0, math.rad(-40)) * CFrame.new(1.5, -.5, 0);
17
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
18
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
19
                CFrame.new(1.5, 0, 0);
20
        };
21
        rshoot = {
22
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(170), 0, 0) * CFrame.new(1.5, -.5, 0);
23
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
24
        };
25
        lshoot = {
26
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(170), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
27
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
28
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(80)) * CFrame.new(-.5, -.35, 0);
29
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
30
        };
31
}
32
local player = game:GetService("Players").LocalPlayer
33
local pmouse = player:GetMouse()
34
local char = player.Character
35
local bin = Instance.new("HopperBin", player.Backpack)
36
local barrelsize = .3
37
local handleweld = nil
38
local temp = true
39
local etemp = true
40
bin.Name = "L96A1 Magnum"
41
function weld(part0, part1, c0, c1, parent)
42
        local w = Instance.new("Weld", parent)
43
        w.Part0 = part0
44
        w.Part1 = part1
45
        w.C0 = c0
46
        w.C1 = c1
47
        w.Name = "NewWeld"
48
        return w
49
end
50
function interpolateCFrame(cf1, cf2)
51
        local t1 = {cf1:components()}
52
        local t2 = {cf2:components()}
53
        local newcf = {}
54
        for i, v in pairs(t1) do
55
                local dif = t2[i] - v
56
                if i < 4 then
57
                        local newValue = nil
58
                        if math.abs(dif) < .1 then
59
                                newValue = t2[i]
60
                        else
61
                                newValue = v +  ((dif/math.abs(dif)) * .1)
62
                        end
63
                        newcf[i] = newValue
64
                else
65
                        local newValue = nil
66
                        if math.abs(dif) < .1 then
67
                                newValue = t2[i]
68
                        else
69
                                newValue = v + ((dif/math.abs(dif)) * .1)
70
                        end
71
                        newcf[i] = newValue
72
                end
73
        end
74
        return CFrame.new(unpack(newcf))
75
end
76
function prop(name, sx, sy, sz, px, py, pz, anc, canc, col, par, mesh, meshtype, scalex, scaley, scalez, meshid, textureid)
77
        local part = Instance.new("Part", par)
78
        part.Name = name
79
        part.TopSurface = 0
80
        part.BottomSurface = 0
81
        part.formFactor = 3
82
        part.Size = Vector3.new(sx, sy, sz)
83
        part.Position = Vector3.new(px, py, pz)
84
        part.Anchored = anc
85
        part.CanCollide = canc
86
        part.BrickColor = BrickColor.new(col)
87
        if mesh then
88
                local m = Instance.new("SpecialMesh", part)
89
                m.MeshType = meshtype
90
                m.MeshId = meshid
91
                m.Scale = Vector3.new(scalex, scaley, scalez)
92
                m.TextureId = textureid
93
        end
94
        return part
95
end
96
function fade(part, speed)
97
        for i = part.Transparency, 1, speed do
98
                part.Transparency = i
99
                wait()
100
        end
101
        part:Destroy()
102
end
103
function clearWelds(par)
104
        for i, v in pairs(par:GetChildren()) do
105
                if v.Name == "NewWeld" and v:IsA("Weld") then
106
                        v:Destroy()
107
                end
108
        end
109
end
110
function sound(pitch, id, par)
111
        local s = Instance.new("Sound", par)
112
        s.Pitch = pitch
113
        s.SoundId = id
114
        return s
115
end
116
function traceRay(pos, pos2, col, trans)
117
        local distance = (pos - pos2).magnitude
118
        local trace = Instance.new("Part", char)
119
        trace.Anchored = true
120
        trace.CanCollide = false
121
        trace.TopSurface = 0
122
        trace.BottomSurface = 0
123
        trace.formFactor = 3
124
        trace.Size = Vector3.new(.2, .2, distance)
125
        trace.BrickColor = BrickColor.new(col)
126
        trace.Transparency = trans
127
        trace.CFrame = CFrame.new(pos2, pos) * CFrame.new(0, 0, -distance/2)
128
        return trace
129
end
130
clearWelds(char.Torso)
131
local back1 = prop("Part1", .1, .7, .5, 0, 0, 0, false, false, "Black", char, false)
132
local back1weld = weld(char.Torso, back1, CFrame.new(1, -2, .6) * CFrame.Angles(math.rad(90), math.rad(20), math.rad(90)), CFrame.new(), char.Torso)
133
local back2 = prop("Part2", .1, .2, .1, 0, 0, 0, false, false, "Grime", char, false)
134
local back2weld = weld(back1, back2, CFrame.new(0, -.25, -.35), CFrame.new(), char.Torso)
135
local back3 = prop("Part3", .1, .5, 1, 0, 0, 0, false, false, "Grime", char, false)
136
local back3weld = weld(back1, back3, CFrame.new(0, .1, -.75), CFrame.new(), char.Torso)
137
local back4 = prop("Part4", .1, .1, 1, 0, 0, 0, false, false, "Grime", char, false)
138
local back4weld = weld(back3, back4, CFrame.new(0, .3, 0), CFrame.new(), char.Torso)
139
local back5 = prop("Part5", .1, .1, .7, 0, 0, 0, false, false, "Grime", char, false)
140
local back5weld = weld(back1, back5, CFrame.new(0, .4, -1.6), CFrame.new(), char.Torso)
141
local trigger1 = prop("Part6", .1, .1, .6, 0, 0, 0, false, false, "Grime", char, false)
142
local trigger1weld = weld(back4, trigger1, CFrame.new(0, -.6, -.4) * CFrame.Angles(-math.rad(30), 0, 0), CFrame.new(), char.Torso)
143
local trigger2 = prop("Part7", .1, .1, .5, 0, 0, 0, false, false, "Grime", char, false)
144
local trigger2weld = weld(back4, trigger2, CFrame.new(0, -.675, -.8) * CFrame.Angles(math.rad(15), 0, 0), CFrame.new(), char.Torso)
145
local trigger3 = prop("Part8", .1, .1, .7, 0, 0, 0, false, false, "Grime", char, false)
146
local trigger3weld = weld(back4, trigger3, CFrame.new(0, -.4, -.95) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
147
local middle1 = prop("Part9", .1, .1, 1, 0, 0, 0, false, false, "Black", char, true, "Brick", .1, .0, .1, "", "") -- dis
148
local middle1weld = weld(back5, middle1, CFrame.new(0, .05, -.8), CFrame.new(), char.Torso)
149
local trigframe = prop("Part10", .1, .3, .3, 0, 0, 0, false, false, "Grime", char, true, "FileMesh", .3, .3, .3, "http://www.roblox.com/asset/?id=3270017", "")
150
local trigframeweld = weld(back5, trigframe, CFrame.new(0, -.2, -.3) * CFrame.Angles(0, math.rad(90), 0), CFrame.new(), char.Torso)
151
local middle2 = prop("Part11", .1, .3, 2, 0, 0, 0, false, false, "Grime", char, false)
152
local middle2weld = weld(middle1, middle2, CFrame.new(0, -.1, -.4), CFrame.new(), char.Torso)
153
local barrel = prop("Part12", .1, .1, 4, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, 1, "", "")
154
local barrelweld = weld(middle1, barrel, CFrame.new(0, -.05, -2), CFrame.new(), char.Torso)
155
local barrel2 = prop("Part13", barrelsize, 2, barrelsize, 0, 0, 0, false, false, "Black", char, false) Instance.new("CylinderMesh", barrel2)
156
local barrel2weld = weld(barrel, barrel2, CFrame.new(0, 0, -2.5) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
157
local scope1 = prop("Part14", .1, .2, .1, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, .5, "", "")
158
local scope1weld = weld(middle1, scope1, CFrame.new(0, .1, .25), CFrame.new(), char.Torso)
159
local scope2 = prop("Part14", .1, .2, .1, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, .5, "", "")
160
local scope2weld = weld(middle1, scope2, CFrame.new(0, .1, -.25), CFrame.new(), char.Torso)
161
local scope3 = prop("Part15", .1, 1.5, .1, 0, 0, 0, false, false, "Black", char, false) Instance.new("CylinderMesh", scope3)
162
local scope3weld = weld(middle1, scope3, CFrame.new(0, .2, 0) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
163
local scope4 = prop("Part16", .2, .3, .2, 0, 0, 0, false, false, "Black", char, true, "FileMesh", .2, .3, .2, "http://www.roblox.com/asset/?id=1033714", "")
164
local scope4weld = weld(middle1, scope4, CFrame.new(0, .2, .7) * CFrame.Angles(math.rad(270), 0, 0), CFrame.new(), char.Torso)
165
local scope5 = prop("Part17", .3, .35, .3, 0, 0, 0, false, false, "Black", char, true, "FileMesh", .3, .35, .3, "http://www.roblox.com/asset/?id=1033714", "")
166
local scope5weld = weld(middle1, scope5, CFrame.new(0, .2, -.7) * CFrame.Angles(math.rad(-270), 0, 0), CFrame.new(), char.Torso)
167
local rarmweld = weld(char.Torso, nil, CFrame.new(1.5, 0, 0), CFrame.new(), char.Torso)
168
local larmweld = weld(char.Torso, nil, CFrame.new(-1.5, 0, 0), CFrame.new(), char.Torso)
169
local gyro = Instance.new("BodyGyro", char.Torso)
170
gyro.P = 10000
171
gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
172
pmouse.Move:connect(function()
173
        gyro.cframe = CFrame.new(char.Torso.Position, Vector3.new(pmouse.Hit.p.X, char.Torso.Position.Y, pmouse.Hit.p.Z))
174
end)
175
function onEquip(mouse)
176
        repeat wait() until etemp and temp
177
        etemp = false
178
        rarmweld.Part1 = char["Right Arm"]
179
        local frame = 1
180
        coroutine.wrap(function()
181
                while rarmweld and animations.requip[frame] do
182
                        rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.requip[frame])
183
                        if rarmweld.C0 == animations.requip[frame] then
184
                                frame = frame + 1
185
                        else
186
                                wait()
187
                        end
188
                end
189
        end)()
190
        repeat wait() until frame == 3
191
        back1weld.Part0 = nil
192
        handleweld = weld(char["Right Arm"], back1, CFrame.new(-.5, 1, -.3) * CFrame.Angles(math.rad(270), 0, 0), CFrame.new(), char.Torso)
193
        repeat wait() until frame == 5
194
        larmweld.Part1 = char["Left Arm"]
195
        local frame2 = 1
196
        coroutine.wrap(function()
197
                while larmweld and animations.lequip[frame2] do
198
                        larmweld.C0 = interpolateCFrame(larmweld.C0, animations.lequip[frame2])
199
                        if larmweld.C0 == animations.lequip[frame2] then
200
                                frame2 = frame2 + 1
201
                        else
202
                                wait()
203
                        end
204
                end
205
                etemp = true
206
        end)()
207
        repeat wait() until frame == 6
208
        mouse.Button1Down:connect(function()
209
                if not temp then return end
210
                temp = false
211
                local frame3 = 1
212
                coroutine.wrap(function()
213
                        while rarmweld and animations.rshoot[frame3] do
214
                                rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.rshoot[frame3])
215
                                if rarmweld.C0 == animations.rshoot[frame3] then
216
                                        frame3 = frame3 + 1
217
                                else
218
                                        wait()
219
                                end
220
                        end
221
                end)()
222
                local frame4 = 1
223
                coroutine.wrap(function()
224
                        while larmweld and animations.lshoot[frame4] do
225
                                larmweld.C0 = interpolateCFrame(larmweld.C0, animations.lshoot[frame4])
226
                                if larmweld.C0 == animations.lshoot[frame4] then
227
                                        frame4 = frame4 + 1
228
                                else
229
                                        wait()
230
                                end
231
                        end
232
                        wait(.1)
233
                        temp = true
234
                end)()
235
                local ray = Ray.new(barrel2.Position, (mouse.Hit.p - barrel2.Position).unit * 500)
236-
                sound(2, "http://www.roblox.com/Asset/?id=16211041", barrel2):play()
236+
                sound(2, "http://www.roblox.com/Asset/?id=1112948895", barrel2):play()
237
                local hit, pos = workspace:FindPartOnRay(ray, char)
238
                if hit and hit.Parent:FindFirstChild("Humanoid") then
239
                        local dmg = math.random(70, 100)
240
                        if hit.Name ~= "Head" then
241
                                hit.Parent.Humanoid:TakeDamage(dmg)
242
                                hit.Parent.Humanoid.Sit = true
243
                        else
244
                                hit.Parent:BreakJoints()
245-
                                sound(1, "http://www.roblox.com/asset/?id=1876552", workspace):play()
245+
                                sound(1, "http://www.roblox.com/asset/?id=283428477", workspace):play()
246
                        end
247
                        if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) == nil then return end
248
                        local bl = Instance.new("Part", workspace)
249
                        bl.Name = "Blood"
250
                        bl.BrickColor = BrickColor.new("Really red")
251
                        bl.FormFactor = 3
252
                        bl.TopSurface = 0
253
                        bl.BottomSurface = 0
254
                        bl.Size = Vector3.new(1, .1, 1)
255
                        bl.Position = hit.Parent.Head.Position + Vector3.new(0, 3, 0)
256
                        local bbg = Instance.new("BillboardGui", bl)
257
                        bbg.Adornee = bl
258
                        bbg.Size = UDim2.new(1, 0, 1, 0)
259
                        bbg.StudsOffset = Vector3.new(0, 1, 0)
260
                        local txt = Instance.new("TextLabel", bbg)
261
                        txt.Position = UDim2.new(0.5, 0, 0.5, 0)
262
                        txt.FontSize = "Size14"
263
                        txt.TextColor3 = Color3.new(1, 1, 1)
264
                        txt.Text = hit.Name ~= "Head" and dmg or "HEADSHOT"
265
                        coroutine.wrap(fade)(bl, 0.005)
266
                end
267
                if hit and hit.Parent:IsA("Hat") then
268
                        hit:BreakJoints()
269
                end
270
                Spawn(function()
271
                        local tr = traceRay(barrel2.Position, pos, "White", .5)
272
                        fade(tr, .01)
273
                end)
274
                repeat wait() until frame4 == 3
275-
                sound(1, "http://roblox.com/asset/?id=10209881", middle2):play()
275+
                sound(1, "http://roblox.com/asset/?id=146740582", middle2):play()
276
        end)
277
end
278
function onUnequip()
279
        repeat wait() until etemp and temp
280
        etemp = false
281
        local frame = 1
282
        coroutine.wrap(function()
283
                while rarmweld and animations.runequip[frame] do
284
                        rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.runequip[frame])
285
                        if rarmweld.C0 == animations.runequip[frame] then
286
                                frame = frame + 1
287
                        else
288
                                wait()
289
                        end
290
                end
291
                etemp = true
292
        end)()
293
        coroutine.wrap(function()
294
                while larmweld do
295
                        larmweld.C0 = interpolateCFrame(larmweld.C0, CFrame.new(-1.5, 0, 0))
296
                        if larmweld.C0 == CFrame.new(-1.5, 0, 0) then
297
                                break
298
                        else
299
                                wait()
300
                        end
301
                end
302
        end)()
303
        repeat wait() until frame == 4
304
        handleweld:Remove()
305
        back1weld:Remove()
306
        back1weld = weld(char.Torso, back1, CFrame.new(1, -2, .6) * CFrame.Angles(math.rad(90), math.rad(20), math.rad(90)), CFrame.new(), char.Torso)
307
        repeat wait() until frame == 7
308
        rarmweld.Part1 = nil
309
        larmweld.Part1 = nil
310
end
311
bin.Selected:connect(onEquip)
312
bin.Deselected:connect(onUnequip)