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

Error on my Minigame script?

minigames = game.Lighting.Minigames:GetChildren()
h = Instance.new("Hint", game.Workspace)

while true do
	if game.Players.NumPlayers > 1 then
		for i = 10, 0, -1 do
			h.Text = "Game starting in: " ..i
			wait(1)
		end
		h.Text = "Welcome to the game."
		wait(3)
		h.Text = "Choosing map..."
		wait(3)
		ranGame = math.random(1, #minigames)
		gameChosen = minigames[ranGame]
		h.Text = "Map Chosen: " ..gameChosen.Name
		wait(3)
		gameChosenClone = gameChosen:Clone()
		gameChosenClone.Parent = game.Workspace
		wait(3)
		spawns = gameChosenClone.Spawns:GetChildren()
		for i,v in pairs(game.Player:GetPlayers()) do
			name = v.Name
			check = game.Workspace:FindFirstChild(name)
			if check then
				checkHumaniod = check:FindFirstChild("Humaniod")
				if checkHumaniod then
					v.Character:MoveTo(spawn[i].Position)
				end
			end
		end
		for i = 5, 0, -1 do
			h.Text = "Game starts in : " ..i
			wait(1)
		end
		for i = 30, 0, -1 do
			h.Text = "Time left: " ..i
			wait(1)
		end
		h.Text = "Game over."
		wait(3)
		gameChosenClone:Destroy()
	else
		h.Text = "There needs to be more than 1 player to start."
	end
	wait(1)
end

My error is Player is not a valid member of DataModel

3 comments

0

What line is the error exactly?

0

It doesn't say, actually.

0

18:36:45.574 - Script 'Workspace.MainScript', Line 22 18:36:45.575 - Stack End, sorry

1 answer

✓ Accepted answer

You mistyped at line 22, it should be game.Players:GetChildren() instead of game.Player:GetPlayers(). And you spelled Humanoid wrong.

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