I want to make the beam that got shot out to damage the player it hit and also remove itself after it has damaged the player that it hit. Script:
player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "e" then
for i = 0,0.5,.1 do
wait()
RightShoulder = game.Workspace.Player.Torso["Right Shoulder"]
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(0,-i,0)
end
for q = 0,0.5,.1 do
wait()
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(q,0,0)
end
wait()
for i = 0,0.5,.1 do
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(-i,0,0)
wait()
end
for i = 0,0.5,.1 do
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(0,i,0)
wait()
end
for i = 3,45 do
wait()
earth = Instance.new("Part",workspace)
earth.Size = Vector3.new(4,4,4)
earth.Name = "Fire"
earth.CanCollide = false
earth.BrickColor = BrickColor.new("Bright red")
earth.Anchored = true
earth.CFrame = player.Character.Torso.CFrame * CFrame.new(0,0,-5+-i) * CFrame.fromEulerAnglesXYZ(math.random(),math.random(),math.random())
player.Character.Torso.Anchored = true
my = game.Lighting.Earth:Clone()
my.Parent = earth
end
player.Character.Torso.Anchored = false
end
end)
