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.

4 comments

0

Most likely Spawns[1] doesn't exist. Write print(Spawns[1]) on line 29.

0

edited to fix formatting

0
  1. 'Spawns' isn't define in this code.. 2. Is Spawns a :GetChildren() of a model? It's unclear in the way you said it
0

it looks like "ElevatorSpawn" maybe is empty, are you sure there is something in that model?