View difference between Paste ID: n6Gkqzs8 and afzrDvZJ
SHOW: | | - or go back to the newest paste.
1
-- This script has been converted to FE by iPxter
2
3
4
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
5
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
6
do
7
	print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
8
	script.Parent = Player.Character
9
10
	--RemoteEvent for communicating
11
	local Event = Instance.new("RemoteEvent")
12
	Event.Name = "UserInput_Event"
13
14
	--Fake event to make stuff like Mouse.KeyDown work
15
	local function fakeEvent()
16
		local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
17
		t.connect = t.Connect
18
		return t
19
	end
20
21
	--Creating fake input objects with fake variables
22
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
23
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
24
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
25
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
26
	end}
27
	--Merged 2 functions into one by checking amount of arguments
28
	CAS.UnbindAction = CAS.BindAction
29
30
	--This function will trigger the events that have been :Connect()'ed
31
	local function te(self,ev,...)
32
		local t = m[ev]
33
		if t and t._fakeEvent and t.Function then
34
			t.Function(...)
35
		end
36
	end
37
	m.TrigEvent = te
38
	UIS.TrigEvent = te
39
40
	Event.OnServerEvent:Connect(function(plr,io)
41
	    if plr~=Player then return end
42
		if io.isMouse then
43
			m.Target = io.Target
44
			m.Hit = io.Hit
45
		else
46
			local b = io.UserInputState == Enum.UserInputState.Begin
47
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
48
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
49
			end
50
			for _,t in pairs(CAS.Actions) do
51
				for _,k in pairs(t.Keys) do
52
					if k==io.KeyCode then
53
						t.Function(t.Name,io.UserInputState,io)
54
					end
55
				end
56
			end
57
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
58
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
59
	    end
60
	end)
61
	Event.Parent = NLS([==[
62
	local Player = game:GetService("Players").LocalPlayer
63
	local Event = script:WaitForChild("UserInput_Event")
64
65
	local UIS = game:GetService("UserInputService")
66
	local input = function(io,a)
67
		if a then return end
68
		--Since InputObject is a client-side instance, we create and pass table instead
69
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
70
	end
71
	UIS.InputBegan:Connect(input)
72
	UIS.InputEnded:Connect(input)
73
74
	local Mouse = Player:GetMouse()
75
	local h,t
76
	--Give the server mouse data 30 times every second, but only if the values changed
77
	--If player is not moving their mouse, client won't fire events
78
	while wait(1/30) do
79
		if h~=Mouse.Hit or t~=Mouse.Target then
80
			h,t=Mouse.Hit,Mouse.Target
81
			Event:FireServer({isMouse=true,Target=t,Hit=h})
82
		end
83
	end]==],Player.Character)
84
	Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
85
end
86
87
-- Created by 129K
88
local animations = {
89
        requip = {
90
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
91
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-15)) * CFrame.new(1.5, -.5, 0);
92
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(210), 0, math.rad(-40)) * CFrame.new(1.5, -.5, 0);
93
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
94
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
95
        };
96
        lequip = {
97
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
98
        };
99
        runequip = {
100
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
101
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-15)) * CFrame.new(1.5, -.5, 0);
102
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(210), 0, math.rad(-40)) * CFrame.new(1.5, -.5, 0);
103
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(180), 0, math.rad(-10)) * CFrame.new(1.5, -.5, 0);
104
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
105
                CFrame.new(1.5, 0, 0);
106
        };
107
        rshoot = {
108
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(170), 0, 0) * CFrame.new(1.5, -.5, 0);
109
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.new(1.5, -.5, 0);
110
        };
111
        lshoot = {
112
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(170), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
113
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
114
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(80)) * CFrame.new(-.5, -.35, 0);
115
                CFrame.new(0, .5, 0) * CFrame.Angles(math.rad(90), 0, math.rad(60)) * CFrame.new(-1, -.75, 0);
116
        };
117
}
118
local player = owner
119
local pmouse = player:GetMouse()
120
local char = player.Character
121
local bin = Instance.new("HopperBin", player.Backpack)
122
local barrelsize = .3
123
local handleweld = nil
124
local temp = true
125
local etemp = true
126
bin.Name = "L96A1 Magnum"
127
function weld(part0, part1, c0, c1, parent)
128
        local w = Instance.new("Weld", parent)
129
        w.Part0 = part0
130
        w.Part1 = part1
131
        w.C0 = c0
132
        w.C1 = c1
133
        w.Name = "NewWeld"
134
        return w
135
end
136
function interpolateCFrame(cf1, cf2)
137
        local t1 = {cf1:components()}
138
        local t2 = {cf2:components()}
139
        local newcf = {}
140
        for i, v in pairs(t1) do
141
                local dif = t2[i] - v
142
                if i < 4 then
143
                        local newValue = nil
144
                        if math.abs(dif) < .1 then
145
                                newValue = t2[i]
146
                        else
147
                                newValue = v +  ((dif/math.abs(dif)) * .1)
148
                        end
149
                        newcf[i] = newValue
150
                else
151
                        local newValue = nil
152
                        if math.abs(dif) < .1 then
153
                                newValue = t2[i]
154
                        else
155
                                newValue = v + ((dif/math.abs(dif)) * .1)
156
                        end
157
                        newcf[i] = newValue
158
                end
159
        end
160
        return CFrame.new(unpack(newcf))
161
end
162
function prop(name, sx, sy, sz, px, py, pz, anc, canc, col, par, mesh, meshtype, scalex, scaley, scalez, meshid, textureid)
163
        local part = Instance.new("Part", par)
164
        part.Name = name
165
        part.TopSurface = 0
166
        part.BottomSurface = 0
167
        part.formFactor = 3
168
        part.Size = Vector3.new(sx, sy, sz)
169
        part.Position = Vector3.new(px, py, pz)
170
        part.Anchored = anc
171
        part.CanCollide = canc
172
        part.BrickColor = BrickColor.new(col)
173
        if mesh then
174
                local m = Instance.new("SpecialMesh", part)
175
                m.MeshType = meshtype
176
                m.MeshId = meshid
177
                m.Scale = Vector3.new(scalex, scaley, scalez)
178
                m.TextureId = textureid
179
        end
180
        return part
181
end
182
function fade(part, speed)
183
        for i = part.Transparency, 1, speed do
184
                part.Transparency = i
185
                wait()
186
        end
187
        part:Destroy()
188
end
189
function clearWelds(par)
190
        for i, v in pairs(par:GetChildren()) do
191
                if v.Name == "NewWeld" and v:IsA("Weld") then
192
                        v:Destroy()
193
                end
194
        end
195
end
196
function sound(pitch, id, par)
197
        local s = Instance.new("Sound", par)
198
        s.Pitch = pitch
199
        s.SoundId = id
200
        return s
201
end
202
function traceRay(pos, pos2, col, trans)
203
        local distance = (pos - pos2).magnitude
204
        local trace = Instance.new("Part", char)
205
        trace.Anchored = true
206
        trace.CanCollide = false
207
        trace.TopSurface = 0
208
        trace.BottomSurface = 0
209
        trace.formFactor = 3
210
        trace.Size = Vector3.new(.2, .2, distance)
211
        trace.BrickColor = BrickColor.new(col)
212
        trace.Transparency = trans
213
        trace.CFrame = CFrame.new(pos2, pos) * CFrame.new(0, 0, -distance/2)
214
        return trace
215
end
216
clearWelds(char.Torso)
217
local back1 = prop("Part1", .1, .7, .5, 0, 0, 0, false, false, "Black", char, false)
218
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)
219
local back2 = prop("Part2", .1, .2, .1, 0, 0, 0, false, false, "Grime", char, false)
220
local back2weld = weld(back1, back2, CFrame.new(0, -.25, -.35), CFrame.new(), char.Torso)
221
local back3 = prop("Part3", .1, .5, 1, 0, 0, 0, false, false, "Grime", char, false)
222
local back3weld = weld(back1, back3, CFrame.new(0, .1, -.75), CFrame.new(), char.Torso)
223
local back4 = prop("Part4", .1, .1, 1, 0, 0, 0, false, false, "Grime", char, false)
224
local back4weld = weld(back3, back4, CFrame.new(0, .3, 0), CFrame.new(), char.Torso)
225
local back5 = prop("Part5", .1, .1, .7, 0, 0, 0, false, false, "Grime", char, false)
226
local back5weld = weld(back1, back5, CFrame.new(0, .4, -1.6), CFrame.new(), char.Torso)
227
local trigger1 = prop("Part6", .1, .1, .6, 0, 0, 0, false, false, "Grime", char, false)
228
local trigger1weld = weld(back4, trigger1, CFrame.new(0, -.6, -.4) * CFrame.Angles(-math.rad(30), 0, 0), CFrame.new(), char.Torso)
229
local trigger2 = prop("Part7", .1, .1, .5, 0, 0, 0, false, false, "Grime", char, false)
230
local trigger2weld = weld(back4, trigger2, CFrame.new(0, -.675, -.8) * CFrame.Angles(math.rad(15), 0, 0), CFrame.new(), char.Torso)
231
local trigger3 = prop("Part8", .1, .1, .7, 0, 0, 0, false, false, "Grime", char, false)
232
local trigger3weld = weld(back4, trigger3, CFrame.new(0, -.4, -.95) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
233
local middle1 = prop("Part9", .1, .1, 1, 0, 0, 0, false, false, "Black", char, true, "Brick", .1, .0, .1, "", "") -- dis
234
local middle1weld = weld(back5, middle1, CFrame.new(0, .05, -.8), CFrame.new(), char.Torso)
235
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", "")
236
local trigframeweld = weld(back5, trigframe, CFrame.new(0, -.2, -.3) * CFrame.Angles(0, math.rad(90), 0), CFrame.new(), char.Torso)
237
local middle2 = prop("Part11", .1, .3, 2, 0, 0, 0, false, false, "Grime", char, false)
238
local middle2weld = weld(middle1, middle2, CFrame.new(0, -.1, -.4), CFrame.new(), char.Torso)
239
local barrel = prop("Part12", .1, .1, 4, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, 1, "", "")
240
local barrelweld = weld(middle1, barrel, CFrame.new(0, -.05, -2), CFrame.new(), char.Torso)
241
local barrel2 = prop("Part13", barrelsize, 2, barrelsize, 0, 0, 0, false, false, "Black", char, false) Instance.new("CylinderMesh", barrel2)
242
local barrel2weld = weld(barrel, barrel2, CFrame.new(0, 0, -2.5) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
243
local scope1 = prop("Part14", .1, .2, .1, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, .5, "", "")
244
local scope1weld = weld(middle1, scope1, CFrame.new(0, .1, .25), CFrame.new(), char.Torso)
245
local scope2 = prop("Part14", .1, .2, .1, 0, 0, 0, false, false, "Black", char, true, "Brick", .5, .5, .5, "", "")
246
local scope2weld = weld(middle1, scope2, CFrame.new(0, .1, -.25), CFrame.new(), char.Torso)
247
local scope3 = prop("Part15", .1, 1.5, .1, 0, 0, 0, false, false, "Black", char, false) Instance.new("CylinderMesh", scope3)
248
local scope3weld = weld(middle1, scope3, CFrame.new(0, .2, 0) * CFrame.Angles(math.rad(90), 0, 0), CFrame.new(), char.Torso)
249
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", "")
250
local scope4weld = weld(middle1, scope4, CFrame.new(0, .2, .7) * CFrame.Angles(math.rad(270), 0, 0), CFrame.new(), char.Torso)
251
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", "")
252
local scope5weld = weld(middle1, scope5, CFrame.new(0, .2, -.7) * CFrame.Angles(math.rad(-270), 0, 0), CFrame.new(), char.Torso)
253
local rarmweld = weld(char.Torso, nil, CFrame.new(1.5, 0, 0), CFrame.new(), char.Torso)
254
local larmweld = weld(char.Torso, nil, CFrame.new(-1.5, 0, 0), CFrame.new(), char.Torso)
255
local gyro = Instance.new("BodyGyro", char.Torso)
256
gyro.P = 10000
257
gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
258
pmouse.Move:connect(function()
259
        gyro.cframe = CFrame.new(char.Torso.Position, Vector3.new(pmouse.Hit.p.X, char.Torso.Position.Y, pmouse.Hit.p.Z))
260
end)
261
function onEquip(mouse)
262
        repeat wait() until etemp and temp
263
        etemp = false
264
        rarmweld.Part1 = char["Right Arm"]
265
        local frame = 1
266
        coroutine.wrap(function()
267
                while rarmweld and animations.requip[frame] do
268
                        rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.requip[frame])
269
                        if rarmweld.C0 == animations.requip[frame] then
270
                                frame = frame + 1
271
                        else
272
                                wait()
273
                        end
274
                end
275
        end)()
276
        repeat wait() until frame == 3
277
        back1weld.Part0 = nil
278
        handleweld = weld(char["Right Arm"], back1, CFrame.new(-.5, 1, -.3) * CFrame.Angles(math.rad(270), 0, 0), CFrame.new(), char.Torso)
279
        repeat wait() until frame == 5
280
        larmweld.Part1 = char["Left Arm"]
281
        local frame2 = 1
282
        coroutine.wrap(function()
283
                while larmweld and animations.lequip[frame2] do
284
                        larmweld.C0 = interpolateCFrame(larmweld.C0, animations.lequip[frame2])
285
                        if larmweld.C0 == animations.lequip[frame2] then
286
                                frame2 = frame2 + 1
287
                        else
288
                                wait()
289
                        end
290
                end
291
                etemp = true
292
        end)()
293
        repeat wait() until frame == 6
294
        mouse.Button1Down:connect(function()
295
                if not temp then return end
296
                temp = false
297
                local frame3 = 1
298
                coroutine.wrap(function()
299
                        while rarmweld and animations.rshoot[frame3] do
300
                                rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.rshoot[frame3])
301
                                if rarmweld.C0 == animations.rshoot[frame3] then
302
                                        frame3 = frame3 + 1
303
                                else
304
                                        wait()
305
                                end
306
                        end
307
                end)()
308
                local frame4 = 1
309
                coroutine.wrap(function()
310
                        while larmweld and animations.lshoot[frame4] do
311
                                larmweld.C0 = interpolateCFrame(larmweld.C0, animations.lshoot[frame4])
312
                                if larmweld.C0 == animations.lshoot[frame4] then
313
                                        frame4 = frame4 + 1
314
                                else
315
                                        wait()
316
                                end
317
                        end
318
                        wait(.1)
319
                        temp = true
320
                end)()
321
                local ray = Ray.new(barrel2.Position, (mouse.Hit.p - barrel2.Position).unit * 500)
322
                sound(2, "http://www.roblox.com/Asset/?id=16211041", barrel2):play()
323
                local hit, pos = workspace:FindPartOnRay(ray, char)
324
                if hit and hit.Parent:FindFirstChild("Humanoid") then
325
                        local dmg = math.random(70, 100)
326
                        if hit.Name ~= "Head" then
327
                                hit.Parent.Humanoid:TakeDamage(dmg)
328
                                hit.Parent.Humanoid.Sit = true
329
                        else
330
                                hit.Parent:BreakJoints()
331
                                sound(1, "http://www.roblox.com/asset/?id=1876552", workspace):play()
332
                        end
333
                        if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) == nil then return end
334
                        local bl = Instance.new("Part", workspace)
335
                        bl.Name = "Blood"
336
                        bl.BrickColor = BrickColor.new("Really red")
337
                        bl.FormFactor = 3
338
                        bl.TopSurface = 0
339
                        bl.BottomSurface = 0
340
                        bl.Size = Vector3.new(1, .1, 1)
341
                        bl.Position = hit.Parent.Head.Position + Vector3.new(0, 3, 0)
342
                        local bbg = Instance.new("BillboardGui", bl)
343
                        bbg.Adornee = bl
344
                        bbg.Size = UDim2.new(1, 0, 1, 0)
345
                        bbg.StudsOffset = Vector3.new(0, 1, 0)
346
                        local txt = Instance.new("TextLabel", bbg)
347
                        txt.Position = UDim2.new(0.5, 0, 0.5, 0)
348
                        txt.FontSize = "Size14"
349
                        txt.TextColor3 = Color3.new(1, 1, 1)
350
                        txt.Text = hit.Name ~= "Head" and dmg or "HEADSHOT"
351
                        coroutine.wrap(fade)(bl, 0.005)
352
                end
353
                if hit and hit.Parent:IsA("Hat") then
354
                        hit:BreakJoints()
355
                end
356
                Spawn(function()
357
                        local tr = traceRay(barrel2.Position, pos, "White", .5)
358
                        fade(tr, .01)
359
                end)
360
                repeat wait() until frame4 == 3
361
                sound(1, "http://roblox.com/asset/?id=10209881", middle2):play()
362
        end)
363
end
364
function onUnequip()
365
        repeat wait() until etemp and temp
366
        etemp = false
367
        local frame = 1
368
        coroutine.wrap(function()
369
                while rarmweld and animations.runequip[frame] do
370
                        rarmweld.C0 = interpolateCFrame(rarmweld.C0, animations.runequip[frame])
371
                        if rarmweld.C0 == animations.runequip[frame] then
372
                                frame = frame + 1
373
                        else
374
                                wait()
375
                        end
376
                end
377
                etemp = true
378
        end)()
379
        coroutine.wrap(function()
380
                while larmweld do
381
                        larmweld.C0 = interpolateCFrame(larmweld.C0, CFrame.new(-1.5, 0, 0))
382
                        if larmweld.C0 == CFrame.new(-1.5, 0, 0) then
383
                                break
384
                        else
385
                                wait()
386
                        end
387
                end
388
        end)()
389
        repeat wait() until frame == 4
390
        handleweld:Remove()
391
        back1weld:Remove()
392
        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)
393
        repeat wait() until frame == 7
394
        rarmweld.Part1 = nil
395
        larmweld.Part1 = nil
396
end
397
bin.Selected:connect(onEquip)
398
bin.Deselected:connect(onUnequip)