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

I'm making an admin panel and the player list wont update?

So the gui will list the players in a server but it will not update upon a player leaving/joining unless you rejoin or reset.

any help?

here's the code to update it

local pos = 0
function update()
	pos = 0
	for k,v in pairs(frame.Plays:GetChildren())do
		v:remove()
	end
	local players = game.Players:GetPlayers()
	for i = 1, #players do
		local label = Instance.new("TextLabel",frame.Plays)
		label.Size = UDim2.new(0.425,0,0.04,0)
		label.TextScaled = true
		label.Text = players[i].Name
		label.Position = label.Position + UDim2.new(0,0,pos,0)
		pos = pos +.04
	end
end
game.Players.PlayerAdded:connect(function(player)
	update()repeat wait() until player.Character
	player.Character.Humanoid.Changed:connect(function()
		update()
	end)
end)
game.Players.PlayerRemoving:connect(function()
	update()
end)
update()

1 comment

0

Is this a LocalScript or a regular Script?

2 answers

✓ Accepted answer

Here it is in a simple aspect:

If this script is a LocalScript, then you should know PlayerAdded and PlayerRemoved don't work properly

If this script is a Regular Script, I assume that you only update frame.Plays within StarterGui instead of all of the player's versions of frame.Plays.

1 comment

0

Thank you so much!

Make sure your place isn't a personal place. If it is, then switch it to a normal place.

1 comment

0

It's not...

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