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