SHOW:
|
|
- or go back to the newest paste.
1 | -- This script has been converted to FE by iPxter | |
2 | ||
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 | do | |
7 | print("FE Compatibility code by Mokiros | Translated to FE by iPxter") | |
8 | script.Parent = Player.Character | |
9 | ||
10 | --RemoteEvent for communicating | |
11 | local Event = Instance.new("RemoteEvent") | |
12 | Event.Name = "UserInput_Event" | |
13 | ||
14 | - | local player=game:service'Players'.LocalPlayer |
14 | + | --Fake event to make stuff like Mouse.KeyDown work |
15 | local function fakeEvent() | |
16 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} | |
17 | - | local mouse=player:GetMouse() |
17 | + | t.connect = t.Connect |
18 | return t | |
19 | end | |
20 | ||
21 | --Creating fake input objects with fake variables | |
22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} | |
23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
26 | end} | |
27 | --Merged 2 functions into one by checking amount of arguments | |
28 | CAS.UnbindAction = CAS.BindAction | |
29 | ||
30 | --This function will trigger the events that have been :Connect()'ed | |
31 | local function te(self,ev,...) | |
32 | local t = m[ev] | |
33 | if t and t._fakeEvent and t.Function then | |
34 | t.Function(...) | |
35 | end | |
36 | end | |
37 | m.TrigEvent = te | |
38 | UIS.TrigEvent = te | |
39 | ||
40 | Event.OnServerEvent:Connect(function(plr,io) | |
41 | if plr~=Player then return end | |
42 | if io.isMouse then | |
43 | m.Target = io.Target | |
44 | m.Hit = io.Hit | |
45 | else | |
46 | local b = io.UserInputState == Enum.UserInputState.Begin | |
47 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
48 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
49 | end | |
50 | for _,t in pairs(CAS.Actions) do | |
51 | for _,k in pairs(t.Keys) do | |
52 | if k==io.KeyCode then | |
53 | t.Function(t.Name,io.UserInputState,io) | |
54 | end | |
55 | end | |
56 | end | |
57 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
58 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
59 | end | |
60 | end) | |
61 | Event.Parent = NLS([==[ | |
62 | local Player = owner | |
63 | local Event = script:WaitForChild("UserInput_Event") | |
64 | ||
65 | local UIS = game:GetService("UserInputService") | |
66 | local input = function(io,a) | |
67 | if a then return end | |
68 | --Since InputObject is a client-side instance, we create and pass table instead | |
69 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) | |
70 | end | |
71 | UIS.InputBegan:Connect(input) | |
72 | UIS.InputEnded:Connect(input) | |
73 | ||
74 | local h,t | |
75 | --Give the server mouse data 30 times every second, but only if the values changed | |
76 | --If player is not moving their mouse, client won't fire events | |
77 | while wait(1/30) do | |
78 | if h~=Mouse.Hit or t~=Mouse.Target then | |
79 | h,t=Mouse.Hit,Mouse.Target | |
80 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
81 | end | |
82 | end]==],Player.Character) | |
83 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
84 | end | |
85 | ---------------------------------------- | |
86 | -- Originally made by Alfederate :D -- | |
87 | ---------------------------------------- | |
88 | ||
89 | -- there's no time to explain! -- | |
90 | ||
91 | local new=Instance.new | |
92 | local rad=math.rad | |
93 | local cf=CFrame.new | |
94 | local v3=Vector3.new | |
95 | local ang=function(x,y,z) | |
96 | return CFrame.Angles(rad(x),rad(y),rad(z)) | |
97 | end | |
98 | local player=owner | |
99 | local char=player.Character | |
100 | local cam=workspace.Camera | |
101 | local weld=function(a,b,c0,c1) | |
102 | m=Instance.new('Motor',a) | |
103 | m.Part0=a | |
104 | m.Part1=b | |
105 | m.C0=c0 | |
106 | m.C1=c1 | |
107 | return m | |
108 | end | |
109 | ||
110 | snd='rbxassetid://233173953' | |
111 | beamm=Instance.new('Model',workspace) | |
112 | beamm.Name='beam' | |
113 | ||
114 | laser=false | |
115 | ||
116 | rs=Instance.new('Part',char) | |
117 | rs.Transparency=1 | |
118 | rs.CanCollide=false | |
119 | rs.TopSurface,rs.BottomSurface=0,0 | |
120 | rs.FormFactor=1 | |
121 | rs.Size=Vector3.new(.5,.5,.5) | |
122 | ||
123 | ls=rs:Clone() | |
124 | ls.Parent=char | |
125 | ||
126 | rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf()) | |
127 | lsw=weld(ls,char.Torso,cf(1,-.5,0),cf()) | |
128 | raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8)) | |
129 | law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43)) | |
130 | ||
131 | s1=Instance.new('Sound',char) | |
132 | s1.Volume=1 | |
133 | s1.Pitch=1 | |
134 | s1.Looped=true | |
135 | s1.SoundId=snd | |
136 | ||
137 | particles={} | |
138 | ||
139 | local wep=new('Part',char) | |
140 | wep.FormFactor=1 | |
141 | wep.CanCollide=false | |
142 | wep.Size=v3(1,3,1) | |
143 | wep.TopSurface,wep.BottomSurface=0,0 | |
144 | local wepw=weld(wep,char['Right Arm'],cf(.26,.4,.7),ang(0,0,8)) | |
145 | ||
146 | local beam=wep:Clone() | |
147 | beam:ClearAllChildren() | |
148 | beam.Material='Neon' | |
149 | beam.BrickColor=BrickColor.new('Hot white') | |
150 | beam.Size=Vector3.new(3,3,1) | |
151 | beam.Transparency=.5 | |
152 | beam.Anchored=true | |
153 | local ms=Instance.new('BlockMesh',beam) | |
154 | local inner=beam:Clone() | |
155 | inner.Transparency=0 | |
156 | inner.Material='SmoothPlastic' | |
157 | inner.BrickColor=BrickColor.new('New Yeller') | |
158 | local ms2=inner.Mesh | |
159 | ||
160 | local expl=inner:Clone() | |
161 | expl.Mesh:Destroy() | |
162 | expl.Material='Neon' | |
163 | expl.BrickColor=BrickColor.new('Bright blue') | |
164 | expl.Size=Vector3.new(11,11,11) | |
165 | expl.Transparency=.55 | |
166 | pl=Instance.new('PointLight',expl) | |
167 | pl.Color=expl.BrickColor.Color | |
168 | pl.Range=pl.Range*2 | |
169 | pl.Name='light' | |
170 | local br=pl.Range | |
171 | ||
172 | local exa=expl:Clone() | |
173 | exa.Size=Vector3.new(4,4,4) | |
174 | pl2=exa.light | |
175 | ||
176 | local part=exa:Clone() | |
177 | part.Size=Vector3.new(1.5,1.5,1.5) | |
178 | pl3=part.light | |
179 | pms=Instance.new('BlockMesh',part) | |
180 | ||
181 | char.Humanoid.Died:connect(function() | |
182 | laser=false | |
183 | beam.Parent=nil | |
184 | inner.Parent=nil | |
185 | expl.Parent=nil | |
186 | exa.Parent=nil | |
187 | s1:stop() | |
188 | end) | |
189 | ||
190 | mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then | |
191 | laser=true | |
192 | s1.Volume=1 | |
193 | s1:play() | |
194 | end end) | |
195 | mouse.Button1Up:connect(function() | |
196 | laser=false | |
197 | beam.Parent=nil | |
198 | inner.Parent=nil | |
199 | expl.Parent=nil | |
200 | exa.Parent=nil | |
201 | s1:stop() | |
202 | - | local player=game:service'Players'.LocalPlayer |
202 | + | |
203 | ||
204 | parti=0 | |
205 | - | local mouse=player:GetMouse() |
205 | + | |
206 | parti=parti+1 | |
207 | for i,v in pairs(particles) do | |
208 | v.CFrame=v.CFrame*CFrame.new(0,0,-.3) | |
209 | v.Transparency=v.Transparency+.08 | |
210 | if v.Transparency >= 1 then | |
211 | v:Destroy() | |
212 | table.remove(particles,i) | |
213 | else | |
214 | v.Parent=beamm | |
215 | end | |
216 | end | |
217 | a=cam.CoordinateFrame.p | |
218 | b=mouse.Hit.p | |
219 | mhitr=Ray.new(a,(b-a).unit*999) | |
220 | mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm}) | |
221 | raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8) | |
222 | law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43) | |
223 | if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then | |
224 | char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z)) | |
225 | end | |
226 | if laser then | |
227 | beamm.Parent=workspace | |
228 | beam.Parent=beamm | |
229 | inner.Parent=beamm | |
230 | expl.Parent=beamm | |
231 | exa.Parent=beamm | |
232 | s1.Volume=s1.Volume-.0 | |
233 | ||
234 | 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) | |
235 | hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm}) | |
236 | ||
237 | if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then | |
238 | Instance.new('Explosion',workspace).Position=pos | |
239 | end | |
240 | if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then | |
241 | e=Instance.new('Explosion',workspace) | |
242 | e.Position=pos | |
243 | e.BlastRadius=14 | |
244 | e.BlastPressure=1e4 | |
245 | end | |
246 | if hit and not hit.Anchored and not (hit:GetMass()>1e4) then | |
247 | hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass()) | |
248 | end | |
249 | ||
250 | if parti==math.floor(parti) then | |
251 | par=part:Clone() | |
252 | table.insert(particles,par) | |
253 | par.Parent=beamm | |
254 | par.Transparency=1-s1.Volume | |
255 | par.light.Range=br*s1.Volume | |
256 | par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10) | |
257 | end | |
258 | ||
259 | mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude | |
260 | ms.Scale=v3(s1.Volume,s1.Volume,mag) | |
261 | ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag)) | |
262 | beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180)) | |
263 | inner.CFrame=beam.CFrame | |
264 | pl.Range=br*s1.Volume | |
265 | pl2.Range=br*s1.Volume | |
266 | expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume | |
267 | expl.Transparency=math.random(40,60)/100 | |
268 | expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180)) | |
269 | exa.Size=v3(4,4,4)*s1.Volume | |
270 | exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180)) | |
271 | char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume) | |
272 | end | |
273 | end) | |
274 | ||
275 | ||
276 | ||
277 | ||
278 | local new=Instance.new | |
279 | local rad=math.rad | |
280 | local cf=CFrame.new | |
281 | local v3=Vector3.new | |
282 | local ang=function(x,y,z) | |
283 | return CFrame.Angles(rad(x),rad(y),rad(z)) | |
284 | end | |
285 | local player=owner | |
286 | local char=player.Character | |
287 | local cam=workspace.Camera | |
288 | local weld=function(a,b,c0,c1) | |
289 | m=Instance.new('Motor',a) | |
290 | m.Part0=a | |
291 | m.Part1=b | |
292 | m.C0=c0 | |
293 | m.C1=c1 | |
294 | return m | |
295 | end | |
296 | ||
297 | snd='rbxassetid://233173953' | |
298 | beamm=Instance.new('Model',workspace) | |
299 | beamm.Name='beam' | |
300 | ||
301 | laser=false | |
302 | ||
303 | rs=Instance.new('Part',char) | |
304 | rs.Transparency=1 | |
305 | rs.CanCollide=false | |
306 | rs.TopSurface,rs.BottomSurface=0,0 | |
307 | rs.FormFactor=1 | |
308 | rs.Size=Vector3.new(.5,.5,.5) | |
309 | ||
310 | ls=rs:Clone() | |
311 | ls.Parent=char | |
312 | ||
313 | rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf()) | |
314 | lsw=weld(ls,char.Torso,cf(1,-.5,0),cf()) | |
315 | raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8)) | |
316 | law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43)) | |
317 | ||
318 | s1=Instance.new('Sound',char) | |
319 | s1.Volume=1 | |
320 | s1.Pitch=1 | |
321 | s1.Looped=true | |
322 | s1.SoundId=snd | |
323 | ||
324 | particles={} | |
325 | ||
326 | local wep=new('Part',char) | |
327 | wep.FormFactor=1 | |
328 | wep.CanCollide=false | |
329 | wep.Size=v3(1,3,1) | |
330 | wep.TopSurface,wep.BottomSurface=0,0 | |
331 | local wepw=weld(wep,char['Right Arm'],cf(.99,.4,1.5),ang(0,0,8)) | |
332 | ||
333 | local beam=wep:Clone() | |
334 | beam:ClearAllChildren() | |
335 | beam.Material='Neon' | |
336 | beam.BrickColor=BrickColor.new('Hot white') | |
337 | beam.Size=Vector3.new(3,3,1) | |
338 | beam.Transparency=.5 | |
339 | beam.Anchored=true | |
340 | local ms=Instance.new('BlockMesh',beam) | |
341 | local inner=beam:Clone() | |
342 | inner.Transparency=0 | |
343 | inner.Material='SmoothPlastic' | |
344 | inner.BrickColor=BrickColor.new('New Yeller') | |
345 | local ms2=inner.Mesh | |
346 | ||
347 | local expl=inner:Clone() | |
348 | expl.Mesh:Destroy() | |
349 | expl.Material='Neon' | |
350 | expl.BrickColor=BrickColor.new('Bright blue') | |
351 | expl.Size=Vector3.new(11,11,11) | |
352 | expl.Transparency=.55 | |
353 | pl=Instance.new('PointLight',expl) | |
354 | pl.Color=expl.BrickColor.Color | |
355 | pl.Range=pl.Range*2 | |
356 | pl.Name='light' | |
357 | local br=pl.Range | |
358 | ||
359 | local exa=expl:Clone() | |
360 | exa.Size=Vector3.new(4,4,4) | |
361 | pl2=exa.light | |
362 | ||
363 | local part=exa:Clone() | |
364 | part.Size=Vector3.new(1.5,1.5,1.5) | |
365 | pl3=part.light | |
366 | pms=Instance.new('BlockMesh',part) | |
367 | ||
368 | char.Humanoid.Died:connect(function() | |
369 | laser=false | |
370 | beam.Parent=nil | |
371 | inner.Parent=nil | |
372 | expl.Parent=nil | |
373 | exa.Parent=nil | |
374 | s1:stop() | |
375 | end) | |
376 | ||
377 | mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then | |
378 | laser=true | |
379 | s1.Volume=1 | |
380 | s1:play() | |
381 | end end) | |
382 | mouse.Button1Up:connect(function() | |
383 | laser=false | |
384 | beam.Parent=nil | |
385 | inner.Parent=nil | |
386 | expl.Parent=nil | |
387 | exa.Parent=nil | |
388 | s1:stop() | |
389 | end) | |
390 | ||
391 | parti=0 | |
392 | - | local player=game:service'Players'.LocalPlayer |
392 | + | |
393 | parti=parti+1 | |
394 | for i,v in pairs(particles) do | |
395 | - | local mouse=player:GetMouse() |
395 | + | |
396 | v.Transparency=v.Transparency+.08 | |
397 | if v.Transparency >= 1 then | |
398 | v:Destroy() | |
399 | table.remove(particles,i) | |
400 | else | |
401 | v.Parent=beamm | |
402 | end | |
403 | end | |
404 | a=cam.CoordinateFrame.p | |
405 | b=mouse.Hit.p | |
406 | mhitr=Ray.new(a,(b-a).unit*999) | |
407 | mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm}) | |
408 | raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8) | |
409 | law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43) | |
410 | if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then | |
411 | char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z)) | |
412 | end | |
413 | if laser then | |
414 | beamm.Parent=workspace | |
415 | beam.Parent=beamm | |
416 | inner.Parent=beamm | |
417 | expl.Parent=beamm | |
418 | exa.Parent=beamm | |
419 | s1.Volume=s1.Volume-.0 | |
420 | ||
421 | 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) | |
422 | hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm}) | |
423 | ||
424 | if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then | |
425 | Instance.new('Explosion',workspace).Position=pos | |
426 | end | |
427 | if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then | |
428 | e=Instance.new('Explosion',workspace) | |
429 | e.Position=pos | |
430 | e.BlastRadius=14 | |
431 | e.BlastPressure=1e4 | |
432 | end | |
433 | if hit and not hit.Anchored and not (hit:GetMass()>1e4) then | |
434 | hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass()) | |
435 | end | |
436 | ||
437 | if parti==math.floor(parti) then | |
438 | par=part:Clone() | |
439 | table.insert(particles,par) | |
440 | par.Parent=beamm | |
441 | par.Transparency=1-s1.Volume | |
442 | par.light.Range=br*s1.Volume | |
443 | par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10) | |
444 | end | |
445 | ||
446 | mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude | |
447 | ms.Scale=v3(s1.Volume,s1.Volume,mag) | |
448 | ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag)) | |
449 | beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180)) | |
450 | inner.CFrame=beam.CFrame | |
451 | pl.Range=br*s1.Volume | |
452 | pl2.Range=br*s1.Volume | |
453 | expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume | |
454 | expl.Transparency=math.random(40,60)/100 | |
455 | expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180)) | |
456 | exa.Size=v3(4,4,4)*s1.Volume | |
457 | exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180)) | |
458 | char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume) | |
459 | end | |
460 | end) | |
461 | ||
462 | ||
463 | ||
464 | ||
465 | --3-- | |
466 | ||
467 | local new=Instance.new | |
468 | local rad=math.rad | |
469 | local cf=CFrame.new | |
470 | local v3=Vector3.new | |
471 | local ang=function(x,y,z) | |
472 | return CFrame.Angles(rad(x),rad(y),rad(z)) | |
473 | end | |
474 | local player=owner | |
475 | local char=player.Character | |
476 | local cam=workspace.Camera | |
477 | local weld=function(a,b,c0,c1) | |
478 | m=Instance.new('Motor',a) | |
479 | m.Part0=a | |
480 | m.Part1=b | |
481 | m.C0=c0 | |
482 | m.C1=c1 | |
483 | return m | |
484 | end | |
485 | ||
486 | snd='rbxassetid://863374181' | |
487 | beamm=Instance.new('Model',workspace) | |
488 | beamm.Name='beam' | |
489 | ||
490 | laser=false | |
491 | ||
492 | rs=Instance.new('Part',char) | |
493 | rs.Transparency=1 | |
494 | rs.CanCollide=false | |
495 | rs.TopSurface,rs.BottomSurface=0,0 | |
496 | rs.FormFactor=3 | |
497 | rs.Size=Vector3.new(.5,.5,.5) | |
498 | ||
499 | ls=rs:Clone() | |
500 | ls.Parent=char | |
501 | ||
502 | rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf()) | |
503 | lsw=weld(ls,char.Torso,cf(1,-.5,0),cf()) | |
504 | raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8)) | |
505 | law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43)) | |
506 | ||
507 | s1=Instance.new('Sound',char) | |
508 | s1.Volume=1 | |
509 | s1.Pitch=1 | |
510 | s1.Looped=true | |
511 | s1.SoundId=snd | |
512 | ||
513 | particles={} | |
514 | ||
515 | local wep=new('Part',char) | |
516 | wep.FormFactor=3 | |
517 | wep.CanCollide=false | |
518 | wep.Size=v3(1,3,1) | |
519 | wep.TopSurface,wep.BottomSurface=0,0 | |
520 | local wepw=weld(wep,char['Right Arm'],cf(-.48,.4,1.5),ang(0,0,8)) | |
521 | ||
522 | local beam=wep:Clone() | |
523 | beam:ClearAllChildren() | |
524 | beam.Material='Neon' | |
525 | beam.BrickColor=BrickColor.new('Hot white') | |
526 | beam.Size=Vector3.new(3,3,1) | |
527 | beam.Transparency=.5 | |
528 | beam.Anchored=true | |
529 | local ms=Instance.new('BlockMesh',beam) | |
530 | local inner=beam:Clone() | |
531 | inner.Transparency=0 | |
532 | inner.Material='SmoothPlastic' | |
533 | inner.BrickColor=BrickColor.new('New Yeller') | |
534 | local ms2=inner.Mesh | |
535 | ||
536 | local expl=inner:Clone() | |
537 | expl.Mesh:Destroy() | |
538 | expl.Material='Neon' | |
539 | expl.BrickColor=BrickColor.new('Bright red') | |
540 | expl.Size=Vector3.new(11,11,11) | |
541 | expl.Transparency=.55 | |
542 | pl=Instance.new('PointLight',expl) | |
543 | pl.Color=expl.BrickColor.Color | |
544 | pl.Range=pl.Range*2 | |
545 | pl.Name='light' | |
546 | local br=pl.Range | |
547 | ||
548 | local exa=expl:Clone() | |
549 | exa.Size=Vector3.new(4,4,4) | |
550 | pl2=exa.light | |
551 | ||
552 | local part=exa:Clone() | |
553 | part.Size=Vector3.new(1.5,1.5,1.5) | |
554 | pl3=part.light | |
555 | pms=Instance.new('BlockMesh',part) | |
556 | ||
557 | char.Humanoid.Died:connect(function() | |
558 | laser=false | |
559 | beam.Parent=nil | |
560 | inner.Parent=nil | |
561 | expl.Parent=nil | |
562 | exa.Parent=nil | |
563 | s1:stop() | |
564 | end) | |
565 | ||
566 | mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then | |
567 | laser=true | |
568 | s1.Volume=1 | |
569 | s1:play() | |
570 | end end) | |
571 | mouse.Button1Up:connect(function() | |
572 | laser=false | |
573 | beam.Parent=nil | |
574 | inner.Parent=nil | |
575 | expl.Parent=nil | |
576 | exa.Parent=nil | |
577 | s1:stop() | |
578 | end) | |
579 | ||
580 | parti=0 | |
581 | game:service'RunService'.Stepped:connect(function() | |
582 | parti=parti+1 | |
583 | for i,v in pairs(particles) do | |
584 | v.CFrame=v.CFrame*CFrame.new(0,0,-.3) | |
585 | v.Transparency=v.Transparency+.08 | |
586 | if v.Transparency >= 1 then | |
587 | v:Destroy() | |
588 | table.remove(particles,i) | |
589 | else | |
590 | v.Parent=beamm | |
591 | end | |
592 | end | |
593 | a=cam.CoordinateFrame.p | |
594 | b=mouse.Hit.p | |
595 | mhitr=Ray.new(a,(b-a).unit*999) | |
596 | mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm}) | |
597 | raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8) | |
598 | law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43) | |
599 | if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then | |
600 | char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z)) | |
601 | end | |
602 | if laser then | |
603 | beamm.Parent=workspace | |
604 | beam.Parent=beamm | |
605 | inner.Parent=beamm | |
606 | expl.Parent=beamm | |
607 | exa.Parent=beamm | |
608 | s1.Volume=s1.Volume-.0 | |
609 | ||
610 | 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) | |
611 | hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm}) | |
612 | ||
613 | if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then | |
614 | Instance.new('Explosion',workspace).Position=pos | |
615 | end | |
616 | if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then | |
617 | e=Instance.new('Explosion',workspace) | |
618 | e.Position=pos | |
619 | e.BlastRadius=14 | |
620 | e.BlastPressure=1e4 | |
621 | end | |
622 | if hit and not hit.Anchored and not (hit:GetMass()>1e4) then | |
623 | hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass()) | |
624 | end | |
625 | ||
626 | if parti==math.floor(parti) then | |
627 | par=part:Clone() | |
628 | table.insert(particles,par) | |
629 | par.Parent=beamm | |
630 | par.Transparency=1-s1.Volume | |
631 | par.light.Range=br*s1.Volume | |
632 | par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10) | |
633 | end | |
634 | ||
635 | mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude | |
636 | ms.Scale=v3(s1.Volume,s1.Volume,mag) | |
637 | ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag)) | |
638 | beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180)) | |
639 | inner.CFrame=beam.CFrame | |
640 | pl.Range=br*s1.Volume | |
641 | pl2.Range=br*s1.Volume | |
642 | expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume | |
643 | expl.Transparency=math.random(40,60)/100 | |
644 | expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180)) | |
645 | exa.Size=v3(4,4,4)*s1.Volume | |
646 | exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180)) | |
647 | char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume) | |
648 | end | |
649 | end) |