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

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

Asked by
ultrabug 306 Moderation Voter
10 years ago

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

Log in to vote
4
Answered by
User#2 0
10 years ago

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.

0
Okay I will see if this will work. ultrabug 306 — 10y
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? ultrabug 306 — 10y
0
It seems I was wrong, you would need the PlayerAdded event, but use it differently. I've updated my answer for you. User#2 0 — 10y
0
Thank you. ultrabug 306 — 10y
Ad

Answer this question