Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This playerlist script and GUIs I made aren't working. Any ideas why?

wait()
local Frame = script.Parent
local Template = Frame.Players
local Script = script
local Players = game:GetService("Players")
local function UpdateLeaderboard(Player)

	local Count = 0
	for i,v in pairs(Players:GetChildren()) do
		Count = Count + 1
		local Slot = Template:Clone()
		Slot.Parent = Frame
		local SlotY = 0.078 * Count
		Slot:TweenPosition(UDim2.new(-0.254,0,SlotY,0), "Out", "Linear", 0)
		Slot.Name = Player.Name
		Slot.Text = Slot.Name
	end
end

game.Players.PlayerAdded:Connect(function(Player)
	UpdateLeaderboard(Player)
end)

game.Players.PlayerRemoving:Connect(function(Player)
	UpdateLeaderboard(Player)
end)

How its setup: https://gyazo.com/0d3f65c7a7d320a744f0ec0be433747e

1 answer

Not entirely sure since I didn't test it, but I have two diagnoses to the problem.

  1. One question, have you tried to test this with multiple clients? It might be the fact that the PlayerAdded event isn't being used on the Local Player because the script didn't load in yet.

If you add this under the UpdateLeaderboard function it should work

UpdateLeaderboard(Players.LocalPlayer)
  1. (unlikely) There is some weird error that is breaking the script when you set the variable Script to script. It is not even used in the script and you can use script instead so there's no point of this variable.

Just remove this:

local Script = script

This discussion is preserved as it was. New answers, comments, and votes are closed.