Hello, I am working on a racing game so that in a certain amount of time the cars respawn. The problem is that the cars don't even spawn in the beginning. I have already typed up a script for it. Here it is:

local GoKart = game.ServerStorage.Kart
function ResetGame ()
	for _, object in pairs(game.Workspace:GetChildren()) do
		if object.Name == "Kart" then
			object:Destroy()
			print("works")
			local KartClone = game.ServerStorage.Kart:Clone()    
			KartClone.Parent = game.Workspace
			KartClone.Position = game.Workspace.CarSpawn
		end
	end
end

ResetGame()

Please help me in my quest of programming.

P.S. I have been following the old RobloxU tutorial so it's an old script.

5 comments

0

Only problem I see is line 9. I'm assuming it's a model. You can't move a model like that. Check the output and post the errors.  

0

There are no errors?

0

Then the function isn't being called or nothing in workspace has the name of Kart, because line 9 will error. Post a print on each line and see what doesn't get printed.

0

Only one "works" got printed

0

I put the print right before the execution of the function, so I suppose that might've been the one.