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

How do I set an automatic update for this to retrieve players upon joining to add more to the GUI?

Asked by 6 years ago
Edited 6 years ago
--  // FileName: GUICreatorV2.lua
--  // Written by: ManOfTrust32
--  // Description: Console SurfaceGUI creation script

game.Players.PlayerAdded:connect(function(player)
        -- Sets player as GUI owner
        local owner = SurfaceGUI.GUIOwner
        owner.Value = player
        -- Creates player avatars and their buttons
        for x, player in pairs(game.Players:GetChildren()) do
            if owner.Value == player then
                return true
            else
                local avatar = game.ServerStorage["Player Avatar/Button"].PlayerAvatar:Clone()
                avatar.Parent = SurfaceGUI.Main.ScrollingFrame
                avatar.Name = player.Name
                avatar.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..player.Name
                local button = game.ServerStorage["Player Avatar/Button"].PlayerButton:Clone()
                button.Parent = SurfaceGUI.Main.ScrollingFrame
                button.Name = player.Name.."'s Button"
                button.Text = player.Name
            end
        end

Been thinking on this one and also tested what I have. First player join doesn't add the second player to their GUI yet second player obviously adds the first.

0
Could you please post the code sample with the extra lines cut out? Just try to cut it down to the minimum example. Thanks! Brouhahaha 27 — 6y
0
Done ManOfTrust32 0 — 6y

Answer this question