View difference between Paste ID: Te6r6cB1 and sMG3Cfie
SHOW: | | - or go back to the newest paste.
1-
----------------------------------------
1+
--https://github.com/Mokiros/roblox-FE-compatibility
2-
 -- Originally made by Alfederate :D -- 
2+
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3-
----------------------------------------
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={},Soundscape=r:GetService("RunService").Heartbeat,BindToSoundscape=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
6
7
 -- there's no time to explain! --
8
9
local new=Instance.new
10
local rad=math.rad
11
local cf=CFrame.new
12
local v3=Vector3.new
13
local ang=function(x,y,z)
14
return CFrame.Angles(rad(x),rad(y),rad(z))
15
end
16
local player=game:service'Players'.LocalPlayer
17
local char=player.Character
18
local cam=workspace.Camera
19
local mouse=player:GetMouse()
20
local weld=function(a,b,c0,c1)
21
m=Instance.new('Motor',a)
22
m.Part0=a
23
m.Part1=b
24
m.C0=c0
25
m.C1=c1
26
return m
27
end
28
29
snd='rbxassetid://306197164'
30
beamm=Instance.new('Model',workspace)
31
beamm.Name='beam'
32
33
laser=false
34
35
rs=Instance.new('Part',char)
36
rs.Transparency=1
37
rs.CanCollide=false
38
rs.TopSurface,rs.BottomSurface=0,0
39
rs.FormFactor=3
40
rs.Size=Vector3.new(.5,.5,.5)
41
42
ls=rs:Clone()
43
ls.Parent=char
44
45
rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf())
46
lsw=weld(ls,char.Torso,cf(1,-.5,0),cf())
47
raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8))
48
law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43))
49
50
s1=Instance.new('Sound',char)
51
s1.Volume=1
52
s1.Pitch=1
53
s1.Looped=true
54
s1.SoundId=snd
55
56
particles={}
57
58
local wep=new('Part',char)
59
wep.FormFactor=3
60
wep.CanCollide=false
61
wep.Size=v3(1,3,1)
62
wep.TopSurface,wep.BottomSurface=0,0
63
local wepw=weld(wep,char['Right Arm'],cf(.26,.4,.7),ang(0,0,8))
64
65
local beam=wep:Clone()
66
beam:ClearAllChildren()
67
beam.Material='Neon'
68
beam.BrickColor=BrickColor.new('Toothpaste')
69
beam.Size=Vector3.new(3,3,1)
70
beam.Transparency=.5
71
beam.Anchored=true
72
local ms=Instance.new('BlockMesh',beam)
73
local inner=beam:Clone()
74
inner.Transparency=0
75
inner.Material='SmoothPlastic'
76
inner.BrickColor=BrickColor.new('Navy blue')
77
local ms2=inner.Mesh
78
79
local expl=inner:Clone()
80
expl.Mesh:Destroy()
81
expl.Material='Neon'
82
expl.BrickColor=BrickColor.new('Toothpaste')
83
expl.Size=Vector3.new(11,11,11)
84
expl.Transparency=.55
85
pl=Instance.new('PointLight',expl)
86
pl.Color=expl.BrickColor.Color
87
pl.Range=pl.Range*2
88
pl.Name='light'
89
local br=pl.Range
90
91
local exa=expl:Clone()
92
exa.Size=Vector3.new(4,4,4)
93
pl2=exa.light
94
95
local part=exa:Clone()
96
part.Size=Vector3.new(1.5,1.5,1.5)
97
pl3=part.light
98
pms=Instance.new('BlockMesh',part)
99
100
char.Humanoid.Died:connect(function()
101
laser=false
102
beam.Parent=nil
103
inner.Parent=nil
104
expl.Parent=nil
105
exa.Parent=nil
106
s1:stop()
107
end)
108
109
mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then
110
laser=true
111
s1.Volume=1
112
s1:play()
113
end end)
114
mouse.Button1Up:connect(function()
115
laser=false
116
beam.Parent=nil
117
inner.Parent=nil
118
expl.Parent=nil
119
exa.Parent=nil
120
s1:stop()
121
end)
122
123
parti=0
124
game:service'RunService'.Stepped:connect(function()
125
parti=parti+1
126
for i,v in pairs(particles) do
127
v.CFrame=v.CFrame*CFrame.new(0,0,-.3)
128
v.Transparency=v.Transparency+.08
129
if v.Transparency >= 1 then
130
v:Destroy()
131
table.remove(particles,i)
132
else
133
v.Parent=beamm
134
end
135
end
136
a=cam.CoordinateFrame.p
137
b=mouse.Hit.p
138
mhitr=Ray.new(a,(b-a).unit*999)
139
mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm})
140
raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8)
141
law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43)
142
if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then
143
char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z))
144
end
145
if laser then
146
beamm.Parent=workspace
147
beam.Parent=beamm
148
inner.Parent=beamm
149
expl.Parent=beamm
150
exa.Parent=beamm
151
s1.Volume=s1.Volume-.002
152
153
ray=Ray.new((wep.CFrame*cf(0,-1.5,0)).p,((wep.CFrame*cf(0,-10,0)).p-(wep.CFrame*cf(0,-1.5,0)).p).unit*999)
154
hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm})
155
156
if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then
157
Instance.new('Explosion',workspace).Position=pos
158
end
159
if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then
160
e=Instance.new('Explosion',workspace)
161
e.Position=pos
162
e.BlastRadius=14
163
e.BlastPressure=1e4
164
end
165
if hit and not hit.Anchored and not (hit:GetMass()>1e4) then
166
hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass())
167
end
168
169
if parti==math.floor(parti) then
170
par=part:Clone()
171
table.insert(particles,par)
172
par.Parent=beamm
173
par.Transparency=1-s1.Volume
174
par.light.Range=br*s1.Volume
175
par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10)
176
end
177
178
mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude
179
ms.Scale=v3(s1.Volume,s1.Volume,mag)
180
ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag))
181
beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180))
182
inner.CFrame=beam.CFrame
183
pl.Range=br*s1.Volume
184
pl2.Range=br*s1.Volume
185
expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume
186
expl.Transparency=math.random(40,60)/100
187
expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
188
exa.Size=v3(4,4,4)*s1.Volume
189
exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
190
char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume)
191
end
192
end)