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
11 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.

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

Any idea what is wrong?

1 answer

Log in to vote
4
Answered by
User#2 0
11 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 — 11y
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 — 11y
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 — 11y
0
Thank you. ultrabug 306 — 11y
Ad

Answer this question