local RespawnCars = game.Workspace.RespawnCars
function RespawnCars()
print("Time to respawn the cars PUNK!") for _, object in pairs (game.Workspace.GetChildren()) do print(object.Name) if object.Name == "Car" then print ("This is a car, we need to destroy it!") object:Destroy() end for _, object in pairs (game.ServerStorage:GetChildren()) do local carCopy = game.ServerStorage.Car:Clone() carCopy.Parent = game.Workspace carCopy:MakeJoints() end end RespawnCars.Touched:connect(RespawnCars)
I have put a copy of the cars in SeverStorage and in the workspace but I have also tried only SeverStorage and only workspace, nothing seems to work, The block that people need to touck is called RespawnCars,
please help.
Thanks.
Hmm, try this;
local respawnCars = game.Workspace.RespawnCars function respawnTheCars() print("Time to respawn the cars PUNK!") for _, object in pairs(game.Workspace.GetChildren()) do print(object.Name) if object.Name == "Car" then print ("This is a car, we need to destroy it!") object:Destroy() end local carCopy = game.ServerStorage.Car:Clone() carCopy.Parent = game.Workspace carCopy:MakeJoints() end end respawnCars.Touched:connect(respawnTheCars)
`