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

Can anyone help me with this script for a custom leaderboard?

If you noticed my last question, this is what I was asking it for, but I seem to have ran into a brick wall and I would like to find a way to climb it. So here is what I had made so far... It is in a local script.

local plr=game.Players.LocalPlayer
game.Players.PlayerAdded:connect(function(np)
	game.StarterGui.SetCoreGuiEnabled("All", false)
	for i, player in pairs(game.Players:GetChildren())do
		GUI=game.ServerStorage.File:Clone()
		plr.PlayerGui.LS.BG:ClearAllChildren()
		GUI.Parent=plr.PlayerGui.LS.BG
		GUI.Position=UDim2.new(1, -200, 0, 20*(i-1))
		GUI.Text=player.Name
	end
end)

Any idea what is wrong?

1 answer

✓ Accepted answer

There are two problems here.

First, ServerStorage isn't replicated to the client. In simple terms, you can't use ServerStorage with a local script, so instead use ReplicatedStorage.

And Second, this only runs when a player is added to the game (not including the local player). You should instead make that anonymous function a normal function (with a name and all) and use that for the event, as well as call it once for setup.

4 comments

0

Okay I will see if this will work.

0

Hmm, it didn't seem to work yet, if it might help the local script was in a screen gui in the starter gui. I removed the PlayerAdded event and it's assosiated end, along with moving the textlabel into replicatedstorage. Any other words of advice?

0

It seems I was wrong, you would need the PlayerAdded event, but use it differently. I've updated my answer for you.

0

Thank you.

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