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

How to make Player script work?

Asked by
TrollD3 105
9 years ago

I want to make this script create a textbutton each time a player enters and when they leave the button will be destroyed. Please help i have been on this same script for the past few days. I seriously need help with this.

A look at my explorer: http://gyazo.com/dc737ffcde271877b05b4d0f6e846c10

function edit(plr)
    for num,p in pairs(game:GetService("Players"):GetPlayers()) do
        for _,obj in pairs(script.Parent.Parent:GetChildren()) do
            if obj.Name == "Player" then
                obj:Destroy()
            end
        end
        local gui = script.Parent:clone()
        gui:ClearAllChildren()
        gui.Position = gui.Position + UDim2.new(0, 0, 0, (num-1)*50) 
        gui.Visible = true
        gui.Parent = script.Parent.Parent
        gui.Name = "Player"
        gui.Text = plr.Name
    end
end
game.Players.PlayerAdded:connect(edit)
game.Players.PlayerRemoving:connect(edit)
0
I need more information. So, when the player enters the SERVER, they are given a gui, but when they leave the SERVER, it's removed? alphawolvess 1784 — 9y
0
@alphawolvess exactly correct! EzraNehemiah_TF2 3552 — 9y

Answer this question