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

Why isnt this Player Entered/Leave script not working?

Asked by
TrollD3 105
9 years ago

I am trying to script a leaderboard type thing that shows a list of players in the game. Not the regular roblox one. Its in a frame that list people in the server. For example: (names of people in the game) TrollD3, BSInc., Swagg, DeezNuts, guest2334, idgaf532, Gottem321,

This is the script I have so far: EDITED!! I want the name to be posted inside the txtbutton and to remove that textbutton when someone leaves. Its not working.

--OnEnter:
lol = 5

game.Players.PlayerAdded:connect(function(p)--Here 
script.Parent.Text = "p.Name" 
script.Parent:clone
script.Parent.Parent.Position = script.Parent.Position + UDim2.new(0,0,lol*1.6,0)   
end)

-- OnLeave:

game.Players.ChildRemoved:connect(function(p)-- Here
 script.Parent.Text = "p.Name" 
script.Parent.Parent.Position = script.Parent.Position + UDim2.new(0,0,lol/1.6,0)
end)



2 answers

Log in to vote
1
Answered by 9 years ago

You made a silly mistake with your parameters and where they go.

--OnEnter:
lol = 5
game.Players.PlayerAdded:connect(function(p)--Here 
script.Parent.Parent.Text = p.Name 
lol = 5
script.Parent.Parent.Position = script.Parent.Position + UDim2.new(0,0,lol*1.6,0)   
end)

-- OnLeave:
game.Players.ChildRemoved:connect(function(p)-- Here
 script.Parent.Parent = p.Name 
script.Parent.Parent.Position = script.Parent.Position + UDim2.new(0,0,lol/1.6,0)
end)


Ad
Log in to vote
0
Answered by 9 years ago

Umm, but Shouldn't Clone Event be wrote ":Clone()", not ":clone"? Also, Shouldn't Player be Wrote player, Not p? I am not sure, don't ask me.

Answer this question