Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Error on my Minigame script?

Asked by
Relatch 550 Moderation Voter
9 years ago
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

0
What line is the error exactly? xImmortalChaos 565 — 9y
0
It doesn't say, actually. Relatch 550 — 9y
0
18:36:45.574 - Script 'Workspace.MainScript', Line 22 18:36:45.575 - Stack End, sorry Relatch 550 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

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

Ad

Answer this question