View difference between Paste ID: cyG0SZr5 and MT9abGJL
SHOW: | | - or go back to the newest paste.
1
if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by WaverlyCole");InternalData = {}
2
do
3
    script.Parent = owner.Character
4
    local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
5
    local function NewFakeEvent()
6
        local Bind = Instance.new("BindableEvent")
7
        local Fake;Fake = {Connections = {},
8
        fakeEvent=true;
9
        Connect=function(self,Func)
10
            Bind.Event:connect(Func)
11
            self.Connections[Bind] = true
12
            return setmetatable({Connected = true},{
13
            __index = function (self,Index)
14
                if Index:lower() == "disconnect" then
15
                    return function() Fake.Connections[Bind] = false;self.Connected = false end
16
                end
17
                return Fake[Index]
18
            end;
19
            __tostring = function() return "Connection" end;
20
        })
21
        end}
22
        Fake.connect = Fake.Connect;return Fake;
23
    end
24
    local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
25
    local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
26
    local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
27
        self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
28
    end};ContextActionService.UnBindAction = ContextActionService.BindAction
29
    local function TriggerEvent(self,Event,...)
30
        local Trigger = Mouse[Event]
31
        if Trigger and Trigger.fakeEvent and Trigger.Connections then
32
            for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
33
        end
34
    end
35
    Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
36
    Event.OnServerEvent:Connect(function(FiredBy,Input)
37
        if FiredBy.Name ~= owner.Name then return end
38
        if Input.MouseEvent then
39
            Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
40
        else
41
            local Begin = Input.UserInputState == Enum.UserInputState.Begin
42
            if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
43
            for _,Action in pairs(ContextActionService.Actions) do
44
                for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
45
            end
46
            Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
47
            UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
48
        end
49
    end)
50
    InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
51
    Event.Parent = NLS([[
52
        local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
53
        local Input = function(Input,gameProcessedEvent)
54
            if gameProcessedEvent then return end
55
            Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
56
        end
57
        UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
58
        local Hit,Target
59
        while wait(1/30) do
60
            if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
61
                Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
62
            end
63
        end
64
    ]],owner.Character)
65
end
66
RealGame = game;game = setmetatable({},{
67
    __index = function (self,Index)
68
        local Sandbox = function (Thing)
69
            if Thing:IsA("Player") then
70
                local RealPlayer = Thing
71
                return setmetatable({},{
72
                    __index = function (self,Index)
73
                        local Type = type(RealPlayer[Index])
74
                        if Type == "function" then
75
                            if Index:lower() == "getmouse" or Index:lower() == "mouse" then
76
                                return function (self)return InternalData["Mouse"] end
77
                            end
78
                            return function (self,...)return RealPlayer[Index](RealPlayer,...) end
79
                        end
80
                        return RealPlayer[Index]
81
                    end;
82
                    __tostring = function(self) return RealPlayer.Name end
83
                })
84
            end
85
        end
86
        if RealGame[Index] then
87
            local Type = type(RealGame[Index])
88
            if Type == "function" then
89
                if Index:lower() == "getservice" or Index:lower() == "service" then
90
                    return function (self,Service)
91
                        local FakeServices = {
92
                            ["players"] = function()
93
                                return setmetatable({},{
94
                                    __index = function (self2,Index2)
95
                                        local RealService = RealGame:GetService(Service)
96
                                        local Type2 = type(Index2)
97
                                        if Type2 == "function" then
98
                                            return function (self,...) return RealService[Index2](RealService,...)end
99
                                        else
100
                                            if Index2:lower() == "localplayer" then return Sandbox(owner) end
101
                                            return RealService[Index2]
102
                                        end
103
                                    end;
104
                                    __tostring = function(self) return RealGame:GetService(Service).Name end
105
                                })
106
                            end;
107
                            ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
108
                            ["userinputservice"] = function() return InternalData["UserInputService"] end;
109
                            ["runservice"] = function()
110
                                return setmetatable({},{
111
                                    __index = function(self2,Index2)
112
                                        local RealService = RealGame:GetService(Service)
113
                                        local Type2 = type(Index2)
114
                                        if Type2 == "function" then
115
                                            return function (self,...) return RealService[Index2](RealService,...) end
116
                                        else
117
                                            local RunServices = {
118
                                                ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
119
                                                ["renderstepped"] = function() return RealService["Stepped"] end
120
                                            }
121
                                            if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
122
                                            return RealService[Index2]
123
                                        end
124
                                    end
125
                                })
126
                            end
127
                        }
128
                        if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
129
                        return RealGame:GetService(Service)
130
                    end
131
                end
132
                return function (self,...) return RealGame[Index](RealGame,...) end
133
            else
134
                if game:GetService(Index) then return game:GetService(Index) end
135
                return RealGame[Index]
136
            end
137
        end
138
        return nil
139
    end
140
});Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
141
 
142
local plr = game.Players.LocalPlayer
143
local char = plr.Character
144
local mouse = plr:GetMouse()
145
local torso = char.Torso
146
local head = char.Head
147
local ra = char["Right Arm"]
148
local la = char["Left Arm"]
149
local rl = char["Right Leg"]
150
local ll = char["Left Leg"]
151
local human = char["Humanoid"]
152
local camera = workspace.CurrentCamera
153
local rs = torso:findFirstChild("Right Shoulder")
154
local ls = torso:findFirstChild("Left Shoulder")
155
local neck = torso:findFirstChild("Neck")
156
local NO_moar_shooting = false
157
local RunService = game:service'RunService'
158
local ammo = 8
159
160
161
local sound = Instance.new("Sound", head)
162
sound.SoundId = "http://roblox.com/asset/?id=10209842"
163
sound.Volume = 1
164
local reloads = Instance.new("Sound", head)
165
reloads.SoundId = "http://roblox.com/asset/?id=10209636"
166
reloads.Volume = 1
167
local activate = Instance.new("Sound", head)
168
activate.SoundId = "http://roblox.com/asset/?id=10209894"
169
activate.Volume = 1
170
171
172
local equipped = false
173
174
local debounce = false
175
176
local face = head.face
177
178
179
release = Instance.new("Part", nil)
180
release.FormFactor = "Custom"
181
release.Size = Vector3.new(0.3, 1.7, 0.3)
182
release.BrickColor = BrickColor.Black()
183
local weld = Instance.new("Weld", release)
184
weld.Part0 = release
185
release.Locked = true
186
weld.Part1 = head
187
weld.C0 = CFrame.new(0, -0.5, -0.2) * CFrame.Angles(math.pi/2, 0, 0)
188
local mesh = Instance.new("CylinderMesh", release)
189
190
release2 = Instance.new("Part", nil)
191
release2.FormFactor = "Custom"
192
release2.Size = Vector3.new(0.2, 1.4, 0.2)
193
release2.BrickColor = BrickColor.Black()
194
release2.Locked = true
195
local weld2 = Instance.new("Weld", release2)
196
weld2.Part0 = release2
197
weld2.Part1 = head
198
weld2.C0 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.pi/2, 0, 0)
199
local mesh2 = Instance.new("CylinderMesh", release2)
200
201
headext = Instance.new("Part", nil)
202
headext.Position = torso.Position
203
headext.FormFactor = "Custom"
204
headext.Transparency = 1
205
headext:BreakJoints()
206
headext.Size = Vector3.new(2, 1, 1)
207
headextw = Instance.new("Weld", headext)
208
headextw.C0 = CFrame.new(Vector3.new(0, 1.5, 0))
209
headextw.Part0 = torso
210
headextw.Part1 = headext
211
headextw.C1 = CFrame.new()
212
headweld = Instance.new("Weld", headext)
213
game:service("RunService").Stepped:connect(function()
214
           headweld.C0 = CFrame.new(Vector3.new(0,0,0), torso.CFrame:pointToObjectSpace(mouse.Hit.p)) * CFrame.Angles(0, 0, 0)
215
end)
216
headweld.Part0 = headext
217
headweld.C1 = CFrame.new()
218
headweld.Part1 = head
219
220
local Screen = Instance.new("ScreenGui", plr:findFirstChild("PlayerGui"))
221
local TextBox = Instance.new("TextLabel", Screen)
222
TextBox.Position = UDim2.new(0.1, 0, 0.95, 0)
223
TextBox.Size = UDim2.new(0, 200, 0.05, 0)
224
TextBox.BackgroundTransparency = 1
225
game:service'RunService'.Stepped:connect(function()
226
TextBox.Text = ("Ammo: "..ammo)
227
end)
228
TextBox.Font = "SourceSansBold"
229
TextBox.TextColor3 = Color3.new(1, 1, 1)
230
TextBox.FontSize = "Size36"
231
TextBox.TextStrokeTransparency = 0
232
233
local pl = Instance.new("PointLight", release)
234
pl.Range = 16
235
pl.Brightness = 5
236
pl.Color = Color3.new(1, 199/255, 67/255)
237
pl.Enabled = false
238
function reload()
239
	if ammo > 7 then return end
240
		reloads:play()
241
		ammo = ammo + 1
242
	activate:play()
243
	wait(0.3)
244
	debounce = false
245
end
246
247
mouse.KeyDown:connect(function(key)
248
	if key == "r" then
249
		if debounce then return end
250
		if not equipped then return end
251
		if ammo > 7 then return end
252
		debounce = true
253
		reload()
254
	end
255
	
256
	if key == "q" then
257
		equipped = not equipped
258
		if equipped then
259
			headext.Parent = char
260
			release.Parent = char
261
			release2.Parent = char
262
			face.Parent = nil
263
			for scale = 0, 1, 0.2 do
264
				weld2.C0 = CFrame.new(0, -scale + 0.5, 0) * CFrame.Angles(math.pi/2, 0, 0)
265
				weld.C0 = CFrame.new(0, -scale + 0.5, -0.2) * CFrame.Angles(math.pi/2, 0, 0)
266
				mesh.Scale = Vector3.new(1, scale, 1)
267
				mesh2.Scale = Vector3.new(1, scale, 1)
268
				wait()
269
				end
270
		else
271
			face.Parent = head
272
			release.Parent = nil
273
			release2.Parent = nil
274
			headext.Parent = nil
275
		end
276
	end
277
end)
278
279
mouse.Button1Down:connect(function()
280
	if not equipped then return end
281
	if ammo < 1 then return end
282
			if debounce then return end
283
			debounce = true
284
			sound:play()
285
			pl.Enabled = true
286
			ammo = ammo - 1
287
			coroutine.wrap(function()
288
				wait(0.07)
289
				pl.Enabled = false
290
				end)()
291
			coroutine.wrap(function()
292
				for scale = 0.7, 1, 0.1 do
293
					mesh.Scale = Vector3.new(1, scale, 1)
294
					wait()
295
				end
296
			end)()
297
			
298
local shell = Instance.new("Part", workspace)
299
shell.BrickColor = BrickColor.Red()
300
shell.FormFactor = "Custom"
301
shell.Size = Vector3.new(0.3, 0.7, 0.3)
302
shell.CFrame = head.CFrame * CFrame.new(0, 0.1, 0.5) * CFrame.Angles(math.pi/2, 0, math.pi/2)
303
local bodyF = Instance.new("BodyVelocity", shell)
304
bodyF.maxForce = Vector3.new(1e5, 0, 1e5)
305
bodyF.P = 1e3
306
bodyF.velocity = head.CFrame.lookVector * -20
307
Instance.new("CylinderMesh", shell)
308
309
local shell2 = Instance.new("Part", shell)
310
shell2.BrickColor = BrickColor.Yellow()
311
shell2.FormFactor = "Custom"
312
shell2.Size = Vector3.new(0.3, 0.2, 0.3)
313
shell2:BreakJoints()
314
local weld = Instance.new("Weld", shell2)
315
weld.Part0 = shell2
316
weld.Part1 = shell
317
weld.C0 = CFrame.new(0, 0.45, 0)
318
Instance.new("CylinderMesh", shell2)
319
coroutine.wrap(function()
320
	wait(0.2)
321
	bodyF:Destroy()
322
	wait(4.8)
323
	
324
	for _ = 0, 5 do
325
		shell.Mesh.Scale = shell.Mesh.Scale + Vector3.new(0.2, 0.2, 0.2)
326
		shell.Transparency = shell.Transparency + 0.2
327
				shell2.Mesh.Scale = shell.Mesh.Scale + Vector3.new(0.2, 0.2, 0.2)
328
		shell2.Transparency = shell.Transparency + 0.2
329
		wait()
330
	end
331
	
332
	shell:Destroy()
333
	end)()
334
			
335
			for bullet = 0, 5 do
336
				coroutine.wrap(function()
337
	if char.Humanoid.Health < 1 then return end
338
    local rayPart         = Instance.new("Part")
339
    rayPart.Name          = "RayPart"
340
    rayPart.BrickColor    = BrickColor.Yellow()
341
    rayPart.Anchored      = true
342
    rayPart.CanCollide    = false
343
	rayPart.Locked = true
344
    rayPart.TopSurface    = Enum.SurfaceType.Smooth
345
    rayPart.BottomSurface = Enum.SurfaceType.Smooth
346
    rayPart.formFactor    = Enum.FormFactor.Custom
347
    rayPart.Size          = Vector3.new(0.2, 0.2, 4)
348
			Instance.new("BlockMesh", rayPart).Scale = Vector3.new(0.2, 0.2, 0.5)
349
	
350
	
351
	
352
    local bulletposition = release.Position
353
   local bulletvelocity = (Vector3.new(math.random(-7,7), math.random(-7,7), math.random(-7,7)))+( mouse.Hit.p - bulletposition).unit*150
354
    local bulletlastposition = bulletposition
355
    rayPart.CFrame = CFrame.new( bulletposition, bulletposition+bulletvelocity )
356
357
358
359
360
    
361
    coroutine.resume(coroutine.create(function()
362
        while true do
363
	        local dt = wait()
364
            bulletlastposition = bulletposition
365
            bulletvelocity = bulletvelocity + (Vector3.new(0, -9.81*10, 0)*dt)
366
	        bulletposition = bulletposition + (bulletvelocity*dt)
367
	rayPart.Parent = workspace
368
                
369
            local ray = Ray.new(bulletlastposition,  (bulletposition - bulletlastposition))
370
            local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayPart} )
371
	            
372
	if (torso.Position - rayPart.Position).magnitude > 440 then
373
	 	rayPart:Destroy()
374
	 break
375
	 end
376
	
377
	
378
            if hit then
379
	local damage = math.random(6, 11)
380
				if hit.Parent:findFirstChild("Humanoid") ~= nil then
381
					hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
382
					    coroutine.wrap(function()
383
        local prt = Instance.new("Part", char)
384
        prt.FormFactor = "Custom"
385
        prt.Size = Vector3.new(0.1, 0.1, 0.1)
386
        prt.Transparency = 1
387
        prt.CanCollide = false
388
        prt.CFrame = CFrame.new(rayPart.CFrame.x, rayPart.CFrame.y, rayPart.CFrame.z)
389
        prt.Anchored = true
390
        coroutine.resume(coroutine.create(function()
391
                        for i = 2, 10, 0.1 do
392
                                if prt == nil then return end
393
                        prt.CFrame = prt.CFrame * CFrame.new(0, 0.05, 0)
394
                        game:service'RunService'.Stepped:wait()
395
                        end
396
        end))
397
        
398
local bg = Instance.new("BillboardGui")
399
bg.Parent = prt
400
bg.Adornee = prt
401
bg.Size = UDim2.new(4, 0, 3.5, 0)
402
bg.ExtentsOffset = Vector3.new(0, 0, 0)
403
local lol = Instance.new("TextLabel")
404
lol.Size = UDim2.new(1.3, 0, 0.4, 0)
405
lol.TextScaled = true
406
lol.TextWrapped = true
407
lol.BackgroundTransparency = 1
408
lol.Parent = bg
409
lol.FontSize = "Size24"
410
lol.TextColor3 = Color3.new(1, 0, 0)
411
lol.TextStrokeTransparency = 0
412
lol.Font = "ArialBold"
413
lol.Text = "-"..damage
414
        
415
wait(3)
416
prt:Destroy()
417
end)()
418
				end
419
				if hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then
420
					hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage
421
										    coroutine.wrap(function()
422
        local prt = Instance.new("Part", char)
423
        prt.FormFactor = "Custom"
424
        prt.Size = Vector3.new(0.1, 0.1, 0.1)
425
        prt.Transparency = 1
426
        prt.CanCollide = false
427
        prt.CFrame = CFrame.new(rayPart.CFrame.x, rayPart.CFrame.y, rayPart.CFrame.z)
428
        prt.Anchored = true
429
        coroutine.resume(coroutine.create(function()
430
                        for i = 2, 10, 0.1 do
431
                                if prt == nil then return end
432
                        prt.CFrame = prt.CFrame * CFrame.new(0, 0.05, 0)
433
                        game:service'RunService'.Stepped:wait()
434
                        end
435
        end))
436
        
437
local bg = Instance.new("BillboardGui")
438
bg.Parent = prt
439
bg.Adornee = prt
440
bg.Size = UDim2.new(4, 0, 3.5, 0)
441
bg.ExtentsOffset = Vector3.new(0, 0, 0)
442
local lol = Instance.new("TextLabel")
443
lol.Size = UDim2.new(1.3, 0, 0.4, 0)
444
lol.TextScaled = true
445
lol.TextWrapped = true
446
lol.BackgroundTransparency = 1
447
lol.Parent = bg
448
lol.FontSize = "Size24"
449
lol.TextColor3 = Color3.new(1, 0, 0)
450
lol.TextStrokeTransparency = 0
451
lol.Font = "ArialBold"
452
lol.Text = "-"..damage
453
        
454
wait(3)
455
prt:Destroy()
456
end)()
457
					end
458
                bulletposition = hitposition
459
                rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
460
                rayPart:Destroy()
461
                break
462
            end
463
	        rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
464
        end
465
    end))
466
				end)()
467
				end
468
		wait(0.3)
469
			debounce = false
470
		
471
end)