Need help with my script

Hey everyone! So today I started working on a Global Leaderboard for my game, and when I play the game to test it out, there is one error. I click on it, and I can’t find the problem. Could someone help me?

The error message is:
GlobalLeaderboard is not a valid member of Workspace “Workspace”

And here is my line of script which is wrong:

Does someone know how to fix this? If so, please tell me.

2 Likes

GlobalLeaderboard probably does not exist yet when this script is ran, try using WaitForChild() and see If It fixes it.

Do you mean replace GetChildren with WaitForChild?

No, I mean using WaitForChild(“GlobalLeaderboard”) which in case it doesn’t exist, It’ll wait until it does.

local GlobalLeaderboard = game.Workspace:WaitForChild("GlobalLeaderboard")
for _, frame in pairs(GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do

You should also make sure GlobalLeaderboard even exists under Workspace, and there are no typos.

Now there is no error from the output, but the leaderboard isn’t updating. It should say success in the output when it updates, but it never happens. Is this a glitch, or did i do something wrong?

You haven’t provided the rest of the script, so we can’t know if there’s any issue over there.

1 Like

Here is the entire script
adding