volantias
(tylove)
#1
Hello! SO currently, my if statement is not working. Any help would be appreciated, thanks! (it is erroring on the middle line.
if #(Teams.Contestants:GetPlayers()) == 1 then
ShowWinner.Text = Teams.Contestants:GetPlayers().Name .. " has won the round!"
end
D0omspire
(doomspire)
#2
May you post the error message please? Thanks.
It will help with the debugging process.
Sceenshots or Text is fine
Forummer
(Forummer)
#3
ShowWinner.Text = Teams.Contestants:GetPlayers()[1].Name .. " has won the round!"
“GetPlayers()” returns an array of players, you need to index that array (in this case you want the player instance which is located at index 1).
1 Like
D0omspire
(doomspire)
#4
Oops, my apology I didn’t read it.
if #(Teams.Contestants:GetPlayers()) == 1 then
ShowWinner.Text = Teams.Contestants:GetPlayers()[1].Name .. " has won the round!"
end
You can’t index a specific player using GetPlayers() you have to index its place in the table.
volantias
(tylove)
#5
Would I do the same here with that? I am trying to team every person ont eh Eliminated Team to the Contestant team
Teams.Eliminated:GetPlayers().Team = Teams.Contestants
Forummer
(Forummer)
#6
for _, EliminatedPlayer in ipairs(Teams.Eliminated:GetPlayers()) do
EliminatedPlayer.Team = Teams.Contestants
end
You’ll need to iterate over every player in the “Eliminated” team.