m = Instance.new("Message") h = Instance.new("Hint") m.Parent = game.Workspace h.Parent = game.Workspace while true do if game.Players.NumPlayers == 1 then m.Text = "Loading-Please wait." wait(3) Spawns = game.Workspace.Elevator.ElevatorSpawn:GetChildren() Spawnz = game.Workspace.LobbySpawn:GetChildren() m.Text = "Teleporting to Elevator" wait(1) 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[1].Position) end end end end wait(3) end
Whenever I run this script the output states: attempt to index field '?' (a nil value)
. The line it is having the error is the line that says: check:MoveTo(Spawns[1].Position)
. It doesn't seem to be recognizing "Spawns" as a variable. In the variables of Spawns and Spawnz the ElevatorSpawn and LobbySpawn are both models, each containing 10 parts inside of them.