#Can someone tell me what I'm doing wrong?

1 messages · Page 1 of 1 (latest)

haughty oyster
#

I'm trying to make a script to update the amount of players on the Main Menu UI but for some reason it wont work and I don't know how to script well

bold knoll
# haughty oyster I'm trying to make a script to update the amount of players on the Main Menu UI ...
label.Text = #game.Players:GetPlayers() --declare the label var according to your UI layout

game.Players.PlayerAdded:Connect(function()
    label.Text = label.Text + 1
end)

game.Players.PlayerRemoving:Connect(function()
    label.Text = label.Text - 1
end)

--optional, for if ResetOnSpawn is set to true inside the ScreenGui instance, while the local script is not located under the screengui
game.Players.LocalPlayer.CharacterAdded:Connect(function()
    label.Text = #game.Players:GetPlayers() --depending on this script's location, you can even potentially remove line 1 if you have add line in
end)