View difference between Paste ID: VGsUgWes and 1gdrm48d
SHOW: | | - or go back to the newest paste.
1-
local plr = game.Players.LocalPlayer
1+
--https://github.com/Mokiros/roblox-FE-compatibility
2
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
4
local RealPlayer = Player
5
do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end local plr = game.Players.LocalPlayer
6
local chr = plr.Character or plr.CharacterAdded:wait()
7
local running = false
8
function new(classname)
9
return Instance.new(classname)
10
end
11
12
chr:WaitForChild("Right Leg")
13
14
local pistol = {gun={}}
15
pistol.gun.Handle = new("Part", chr)
16
pistol.gun.Handle.Size = Vector3.new(0.2, 0.8, 0.8)
17
pistol.gun.Mesh = new("SpecialMesh")
18
pistol.gun.Mesh.MeshType = Enum.MeshType.FileMesh
19
pistol.gun.Mesh.MeshId = "http://www.roblox.com/asset/?id=72012879"
20
pistol.gun.Mesh.TextureId = "http://www.roblox.com/asset/?id=72012859"
21
pistol.gun.Mesh.Scale = Vector3.new(1.25,1.25,1.25)
22
pistol.gun.Mesh.Parent = pistol.gun.Handle
23
pistol.gun.Handle.CanCollide = false
24
pistol.gun.Handle.Anchored = true
25
pistol.gun.Handle.Parent = workspace
26
pistol.gun.Sound = new("Sound")
27
pistol.gun.Sound.SoundId = "rbxassetid://214504315"
28
pistol.gun.Sound.Parent = pistol.gun.Handle
29
wait()
30
pistol.gun.CFrame = chr["Right Leg"].CFrame
31
local w = Instance.new("Weld",chr["Right Leg"])
32
w.Part0 = pistol.gun.Handle
33
w.Part1 = chr["Right Leg"]
34
w.C0 = chr["Right Leg"].CFrame
35
w.C1 = CFrame.new(0.6,0.5,0) * CFrame.Angles(math.rad(180),0,0) * chr["Right Leg"].CFrame
36
pistol.gun.Handle.Anchored = false
37
38
local il = {chr,pistol.gun.Handle}
39
40
function fire(start,stop)
41
pistol.gun.Sound:play()
42
local part,pos = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(start,(stop-start).unit*90),il)
43
local bullet = new("Part")
44
table.insert(il,bullet)
45
bullet.BrickColor = BrickColor.new("Pastel yellow")
46
bullet.FormFactor = "Custom"
47
bullet.Anchored = true
48
bullet.CanCollide = false
49
bullet.Size = Vector3.new(0.1, 0.1, (start - pos).magnitude)
50
bullet.CFrame = CFrame.new(start, pos) * CFrame.new(0, 0, -(start - pos).magnitude / 2)
51
bullet.Parent = game.Workspace
52
local bm = new("BlockMesh")
53
bm.Scale = Vector3.new(.5,.5,1)
54
bm.Parent = bullet
55
if part ~= nil then
56
if part.Parent:findFirstChild("Humanoid") then
57
part.Parent:BreakJoints()
58
end
59
end
60
spawn(function() wait(.07) bullet:Destroy() end)
61
end
62
63
game:GetService("UserInputService").InputBegan:connect(function(inp,gpe)
64
if not gpe then
65
if inp.UserInputType == Enum.UserInputType.Keyboard then
66
if inp.KeyCode == Enum.KeyCode.E then
67
if running == false then
68
running = true
69
chr.Humanoid.WalkSpeed = 0
70
w.Part1 = chr["Right Arm"]
71
w.C0 = chr["Right Arm"].CFrame
72
w.C1 = CFrame.new(0,-1.4,-.4) * CFrame.Angles(math.rad(180),0,0) * chr["Right Arm"].CFrame
73
local w2 = new("Weld")
74
w2.Name = "Right_Weld"
75
w2.Parent = chr.HumanoidRootPart
76
w2.Part0 = chr.HumanoidRootPart
77
w2.Part1 = chr["Right Arm"]
78
w2.C1 = CFrame.new(-.5, 2, 0) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-90))
79
wait(1)
80
for i = 1,45 do
81
if i%3 == 0 then
82
fire(pistol.gun.Handle.CFrame.p,(pistol.gun.Handle.CFrame * CFrame.Angles(math.rad(90),0,0)).lookVector*100)
83
end
84
chr.Torso.CFrame = chr.Torso.CFrame * CFrame.Angles(0,math.rad(8),0)
85
wait(.01)
86
end
87
wait(.5)
88
chr.Humanoid.WalkSpeed = 16
89
w2:Destroy()
90
w.Part1 = chr["Right Leg"]
91
w.C0 = chr["Right Leg"].CFrame
92
w.C1 = CFrame.new(0.6,0.5,0) * CFrame.Angles(math.rad(180),0,0) * chr["Right Leg"].CFrame
93
wait(1)
94
running = false
95
end
96
end
97
end
98
end
99
end)