I am making this beam script (which you might know from previous questions) which creates a line of parts (Balls). But when I try to destroy them after they shoot, the beam stops after a quarter of it has been shot out. Help pls! script:
player = game.Players.LocalPlayer mouse = player:GetMouse() mouse.KeyDown:connect(function(key) key = key:lower() if key == "f" then wait(0.5) for i = 3,60 do wait() earth = Instance.new("Part",workspace) earth.Shape = "Ball" earth.Size = Vector3.new(1,1,1) 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.Script:Clone() my.Parent = earth end player.Character.Torso.Anchored = false end end)
At the end add:
wait(1) for i, v in pairs(workspace:GetChildren()) do if v then if v.Name == 'earth' and v.className == 'BasePart' then v:remove() end end end -- would be better if the parts are created inside the char, so that if anything is named 'earth' it does not get deleted.