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