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