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)

5 comments

0

I made most the script :3

0

^^ I k thanks a lot. It helps but doesnt work. lol

1

We don't know what the error is though ^_^

0

IK^^ This problem is driving me nuts. Maybe someone should just do this for me.

0

Try using a xpcall function it should grab the error.