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
01 | local pos = 0 |
02 | function update() |
03 | pos = 0 |
04 | for k,v in pairs (frame.Plays:GetChildren()) do |
05 | v:remove() |
06 | end |
07 | local players = game.Players:GetPlayers() |
08 | for i = 1 , #players do |
09 | local label = Instance.new( "TextLabel" ,frame.Plays) |
10 | label.Size = UDim 2. new( 0.425 , 0 , 0.04 , 0 ) |
11 | label.TextScaled = true |
12 | label.Text = players [ i ] .Name |
13 | label.Position = label.Position + UDim 2. new( 0 , 0 ,pos, 0 ) |
14 | pos = pos +. 04 |
15 | end |
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.