Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Efficient way to start a game?

Okay so currently I put a wait time for my scripts to begin after the game starts but I know other people do it differently. I looked it up and I think waitforchild is what I need. How would I use that in order to make sure my scripts don't run before the first player too join a server spawns?

1 comment

0

The last major thing to load in a Player is the Character (player.Character), so you need to use either WaitForChild or FindFirstChild to check if the player is alive and make sure the code doesen't run if it's not.

1 answer

I think this is what you're talking about:

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
					--Start Your Game
					end
				end	
			end
		end

This discussion is preserved as it was. New answers, comments, and votes are closed.