I made this lighting script so that every time u press T u shoot lighting but the lightning bolt doesnt show and when i try it just shows a spread of parts which i tried to make into a bolt shape and it doesnt do damage Here is the script can u please help

local player = game.Players.LocalPlayer
local character = player.Character

local Light1 = Instance.new("Part")
Light1.BrickColor = BrickColor.new("Light blue")
Light1.TopSurface = "Smooth"
Light1.Material = "Neon"
Light1.Anchored = true
Light1.CanCollide = false
Light1.Size = Vector3.new(5,1,1)
local light2 = Instance.new("Part")
light2.BrickColor = BrickColor.new("Light blue")
light2.Anchored = true
light2.CanCollide = false
light2.TopSurface = "Smooth"
light2.Material = "Neon"
light2.Size = Vector3.new(1,2,1)
local light3 = Instance.new("Part")
light3.BrickColor = BrickColor.new("Light blue")
light3.TopSurface = "Smooth"
light3.Material = "Neon"
light3.Anchored = true
light3.CanCollide = false
light3.Size = Vector3.new(5,1,1)

local Humanoid = character:WaitForChild("Humanoid")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://4577006839"
local LoadedAnimation = Humanoid:LoadAnimation(Animation)
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, GPE)
    if not GPE then
        if input.KeyCode == Enum.KeyCode.T then
	

	script.Lightning:Play()
	LoadedAnimation:Play()

	local C1 = Light1:Clone()
	C1.Parent = game.Workspace
	C1.CFrame = character.UpperTorso.CFrame * CFrame.new(0,0,0)
	local C2 = light2:Clone()
	C2.Parent = game.Workspace
	C2.CFrame = character.UpperTorso.CFrame * CFrame.new(5,0,0)
	local C3 = light3:Clone()
	C3.Parent = game.Workspace
	C3.CFrame = character.UpperTorso.CFrame * CFrame.new(5,-2,0) wait (1)
	C1:Destroy()
	C2:Destroy()
	C3:Destroy()
	
	
	C1.Touched:connect(function(hit)
	if hit.Parent == not character then
	hit.Parent.Humanoid:TakeDamage(40)
	C2.Touched:connect(function(hit2)
	hit2.Parent.Humanoid:TakeDamage(40)
	C3.Touched:connect(function(hit3)
	hit3.Parent.Humanoid:TakeDamage(40)
	
		
	end)	
	end)	
	end	
	end)
		
	end
end
end)	
wait (1)


7 comments

0

the wait 1 is to destroy C1,C2,C3 after some time to get rid of the lightning bolt

0

also i just need help making it do dmg i changed the position of the bolt

0

Why is the damage being dealt locally?

0

what do you mean by that?

0

You're dealing damage in a LocalScript. Damage should be dealt on the server with a normal script. You can use a RemoteEvent to fulfill this.

0

it worked in my other script doe :/ my fireball script

0

and also if i use a remote event how am i supposed to tell where to dmg