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

How do I make this get all Players in the game and put them in the Scrolling Frame?

sf = script.Parent

game.Players.PlayerAdded:connect(function(player)
   	local su = Instance.new("TextButton")
	su.Parent = sf
	local uid = player.UserId
	su.Name = player.Name
	su.Size = UDim2.new(1, 0, 0.04, 0)
	su.Text = player.Name..":"..uid
	su.Font = "SourceSansLight"
	su.FontSize = "Size28"
	
end)
	

2 comments

0

Local Script

0

wait no its not a local script

1 answer

I went head and redone the code for you. I don't know if this is just for the player him/her self or if it updates to everyone and is this Server Script or LocalScript?

Here the code.

local PlayersScroll = {}

sf = script.Parent

game.Players.PlayerAdded:connect(function(player)
	if PlayersScroll[player.Name] == nil then
		local su = Instance.new("TextButton")
		su.Parent = sf
		local uid = player.UserId
		su.Name = player.Name
		su.Size = UDim2.new(1, 0, 0.04, 0)
		su.Text = player.Name..":"..uid
		su.Font = "SourceSansLight"
		su.FontSize = "Size28"
		PlayersScroll[player.Name] = su
	end

end)

game.Players.PlayerRemoving:connect(function(player)
	if PlayersScroll[player.Name] ~= nil then
		PlayersScroll[player.Name]:Destroy()
		table.remove(PlayersScroll, player.Name)
	end
end)

2 comments

0

The only thing is that it doesn't update for the player that joins so I can't see the players that joined before me.

0

Tell me how do you want the script to work? You said something about see the players that has joined before you? Do you mean u want it to show you who joined the game whilst you was not on?

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