I have a block that you can click on that shoots a part. and I want the cannonball to disappear for existing for longer than about 5 seconds Help?
Code here V
local clickdetector = script.Parent:WaitForChild("ClickDetector")
clickdetector.MouseClick:Connect(function()
local copy = game.Workspace.Part:Clone()
copy.Parent = workspace
copy.Position = game.Workspace.Cannon.Position
copy.Anchored = true
while true do
copy.Position = copy.Position + Vector3.new (3,0,0)
wait(0.05)
end
end)

1 comment
Everything you need now is Debris service https://developer.roblox.com/en-us/api-reference/class/Debris