local m = Instance.new("Message")
local h = Instance.new("Hint")
while true do
if game.Players.NumPlayers == 1 then
wait(1)
m.Text = "Loading-Please wait."
wait(3)
local Spawns1 = game.Workspace.Elevator.ElevatorSpawn:GetChildren()
wait(1)
local Spawns2 = game.Workspace.LobbySpawn:GetChildren()
wait(1)
m.Text = "Teleporting to Elevator"
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
local name = v.Name
local check = game.Workspace:FindFirstChild(name)
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
check:MoveTo(Spawns1[1].Position)
wait(5)
end
end
end
end
end
Every time I click "Play" the green bar at the bottom of ROBLOX Studio goes about halfway, then stops. It will sit there for about a minute and then come up with a pop-up that says: "Roblox Studio is not responding."
My game worked fine while I was working on other scripts, so I know that this one is causing it to crash. I'm not exactly sure why. I added waits in between the variables and functions but it doesn't help. Do I need to add waits in between the "ends" at the bottom?

4 comments
Could you please put your code in lua format? :)
Edited for code block.
Oh yeah sorry wasn't in format should be fixed now.
You should put a 'wait' in your 'while' loop: your problem is your first 'if' statement: if there're not '1' player(s) in your game, then it wont follow the following chunks: + Player assets doesn't load for a little bit. :)