So I am trying to get this script to teleport players at a certain time to bricks called "Spawns" in my game. The problem is that the teleport part of the script isn't working.....
In the output it says the problem is that...."'Spawns' (a nil value)" even though they are in the game.
` spawns = gameChosenClone.Spawns:GetChildren() for i,v in pairs(game.Players:GetPlayers()) do name = v.Name check = game.Workspace:FindFirstChild(name) if check then checkHumanoid = check:FindFirstChild("Humanoid") if checkHumanoid then check:MoveTo(spawns[i].Position) end end end for i = 3, 1, -1 do`
Try using the "PlayerAdded" instance instead of "Spawns" because that isnt specific enough for the scrip to render, if you were to make that work you would have to specify the path and what object you are trying to get to teleport for it to tell if the "spawns" is true, plus, the function is Spawn, not spawns, which in any programming language, the slightest misspellings can lead to tedious hours of work looking for the issue. Also, gameChosenClone.Spawns
again, Spawn, not spawns, vitally crucial difference there. As well as the proper variable seperation would be game.ChosenClone
. In line 08 is the check:MoveTo(spawns[i].Position)
supposed to be the Spawn class as already stated or is it the name of a model? Other than these issues, it looks just fine. Remember, there is more than one way to do things in any language. Stay open-minded and most importantly have fun with it.