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