as you can see i am put here multiple times for some reason, i need that the buttons fill with current players and other leaves with “None” + the client with “You”
IDK, but that is going to loop through every player for each button, you’ll probably end up with the last player found repeated for each button by doing it that way.
maybe loop through players, then the buttons skipping the button if the text ~= ‘None’
You loop through the buttons
In each “loop” you loop through the players
If a Player has that name it is named to “You” You are most likely the only player in your experience at the moment
The loop starts again and checks everytime
I am not sure how you made your logic, but you should change it up
As coolyoshi said, you need to change your logic.
This is just some pseudo-code, and it guesses that there is a button per player.
local playersList = game:GetService("Players"):GetPlayers()
for Index, Buttons in Selects do
if Buttons:IsA("UIGridLayout") then
return
end
local player = playersList[index]
if not player then
return
end
if Player.Name == LocalPlayer.Name then
Buttons.Text = "You"
else
Buttons.Text = Player.Name
end
end
How should i change it?
if GUI.Enabled == false then
GUI.Enabled = true
for i,Buttons in Selects do
for playerIndex,Player in game:GetService(“Players”):GetPlayers() do
if not Buttons:IsA(“UIGridLayout”) then
if Player.Name == LocalPlayer.Name then
Buttons.Text = “You”
else
Buttons.Text = Player.Name
end
end
end
end
end