Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago
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)


0
Local Script HarveyRSpecter 5 — 7y
0
wait no its not a local script HarveyRSpecter 5 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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)
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. HarveyRSpecter 5 — 7y
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? xxmobkiller 5 — 7y
Ad

Answer this question