My Car Spawner works but it won't delete or anything I tried destroying it, using a part to destroy it, putting a script that is cloned that waits 10 seconds to remove it nothing worked.
It's like roblox "destroy" and "remove" feature is broken.
local RandomCar = math.random(1,4)
local Cars = game.ReplicatedStorage.Cars:GetChildren()
local debounce = false
while true do
wait(5)
for i,v in pairs(Cars) do
local CarClone = v:Clone()
CarClone.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not debounce then
debounce = true
hit.Parent.Humanoid.Health = 0
script.HitSound:Play()
wait(2)
debounce = false
end
end)
if RandomCar == 1 then
CarClone.Parent = workspace.CarSpawnFolder
CarClone.CFrame = workspace.CarPos1.CFrame
while true do
wait()
for i= 1, 300 do
CarClone.CFrame = CarClone.CFrame * CFrame.new(0,0,2)
wait()
end
end
wait(10)
CarClone:Remove()
else
if RandomCar == 2 then
CarClone.Parent = workspace.CarSpawnFolder
CarClone.CFrame = workspace.CarPos2.CFrame
while true do
wait()
for i= 1, 300 do
CarClone.CFrame = CarClone.CFrame * CFrame.new(0,0,2)
wait()
end
end
wait(10)
CarClone:Remove()
else
if RandomCar == 3 then
CarClone.Parent = workspace.CarSpawnFolder
CarClone.CFrame = workspace.CarPos1.CFrame
while true do
wait()
for i= 1, 300 do
CarClone.CFrame = CarClone.CFrame * CFrame.new(0,0,2)
wait()
end
end
wait(10)
CarClone:Remove()
else
if RandomCar == 4 then
CarClone.Parent = workspace.CarSpawnFolder
CarClone.CFrame = workspace.CarPos2.CFrame
while true do
wait()
for i= 1, 300 do
CarClone.CFrame = CarClone.CFrame * CFrame.new(0,0,2)
wait()
end
end
wait(10)
CarClone:Remove()
end
end
end
end
end
end

4 comments
And yes, I tried both Destroy and Remove.
I'll check back tomorrow if there is any help, anything helps.
Of course nothing is happening, you never break out of the loops so the thread is held.
Forgot to do that ziff