Yes. Lightning, not lighting, the thundery loud lightning. Yet again, I can't provide much code for this one, I guess the only code I can provide is..
1 | function CreateLightning() |
2 |
3 | end |
4 |
5 | MouseButton 1 Click:connect(CreateLightning) |
or
1 | MouseButton 1 Click:connect( function () |
2 |
3 | end ) |
So what I'm trying to accomplish is an effect similar to that of Stravant's Lighting. I'm making an RPG and this will become really helpful! Thanks in advance, jakei181
Get a brick and put this into a normal script not a local script. Also, insert a "ClickDetector" into the brick and you're good to go. I hope this helps. :)
01 | repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild( 'Head' ) and game.Players.LocalPlayer:GetMouse() |
02 | local plr = game.Players.LocalPlayer |
03 | local char = plr.Character |
04 | local head = char.Head |
05 | local mouse = plr:GetMouse() |
06 |
07 | mouse.Button 1 Down:connect( function () |
08 | local s,f = head.Position,mouse.Hit.p |
09 | local hit,pos = workspace:FindPartOnRayWithIgnoreList(Ray.new(s,(f-s).unit* 999 ),char:children()) |
10 | local dist = (s-pos).magnitude |
11 | local lastp = s |
12 | for i = 1 , 10 do |
13 | local newp = (CFrame.new(s,pos)*CFrame.new( 0 , 0 ,-i*(dist/ 10 ))).p+Vector 3. new(math.random(- 50 , 50 )/ 20 ,math.random(- 50 , 50 )/ 20 ,math.random(- 50 , 50 )/ 20 ) |
14 | local newdist = (lastp-newp).magnitude |
15 | local p = Instance.new( 'Part' ,char) game:service( 'Debris' ):AddItem(p,. 5 ) |