Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Objects that respawn automatically start spawning on each other and duplicating?

Asked by 2 years ago
Edited 2 years ago

I am trying to create the car spawning effect that Down Hill Smash uses and I got it working except that if the cars aren't destroyed by the void before new cars spawn, they all spawn in the same spot and duplicate every time it happens, causing massive game lag.

Here's the code that I am using:

local model = game.ReplicatedStorage.Cars.RedCar1
while true do 
    wait(5) -- regenerates the model after 5 seconds
    backup = model:Clone() -- backs up the model so it can respawn
    backup.Parent = game.Workspace
    backup:MoveTo(Vector3.new(-105.042,203.5,100.995))
end

Answer this question