Help needed, Leaderboard Cash

I am looking to fix my Custom Leaderboard GUI

I have not yet tested the GUI to my testers but I believe that this GUI will only show the cash value of the local player in game and not the Currentplayer name the text is displaying. The Gui displays the players name fine, just that the cash is displaying only the local player cash.

Cash code—
local player = game.Players.LocalPlayer
local Cash = player:WaitForChild(“leaderstat”):WaitForChild(“Cash”) "

The Text Code—
“PlayerName.Text = CurrentPlayer.Name … " $” … tostring(Cash.Value)"
The reason why my gut is saying this is because of this "

Update cash Code—
Cash.Changed:Connect(function()

My scripting team is just me and chat gdt. I do not consider myself to be a scripter because of my lack of knowledge. This should be a easy fix for experience scripters.

Who ever gets it right will get a solution check

I will soon show the full script.

3 Likes


1 Like

Could you rephrase what you said wasn’t working? I was kinda confused about that part.

P.S. The script provided by ChatGPT is well, interesting

Cash.Changed:Connect(function()

The above could be change to this:

Cash:GetPropertyChangedSignal(“Value”):Connect(function()
-- Your code
end)

Alright, This code “PlayerName.Text = CurrentPlayer.Name … " $” … tostring(Cash.Value)” displays the current player name, then right beside it, the player cash value. The problem is that the cash value isnt displaying the current player cash value, instead it is displaying the local player cash value.

And Just to inform you guys, This script was not created by ChatGPT, it was from the toolbox. I Just use ChatGPT to solve script errors for me.

1 Like

Ah okay I think I know what you’re talking about now; so when the player gets cash, it doesn’t update to their current cash [value] on the TextLabel.

Edit: If this is the case just try this then ig:

Cash:GetPropertyChangedSignal(“Value”):Connect(function()
-- Your code
end)

Seems like the time between replies is kinda long so ima do smthn until you respond

1 Like

OK, sorry for me not explaining well, I’m just a novice.

This Leaderboard GUI displays all the players names in the server. It also displays all the players cash aswell making it visible for everyone to see. Each player has their own cash. BUT, The problem is the cash is only showing the Local player cash. Meaning that this leaderboard GUI shows my cash value in next to my friends name.

Wait ohhhh okay okay I get it now, lemme analyze the script again hold up

Okay I see, “PlayersList” is not defined. Just do this:

local PlayersList = game.Players:GetPlayers()
2 Likes

For those who are still confuse, this is basically in a illustration, You, Bobby, and Tim join the game. A GUI appears in the game, This GUI shows all the players in the server, and all the players cash. But, Tim, Bob have the exact same amount of cash you have? Why? Because the Cash is displaying the not Bob or Tim’s Cash, But yours.

I want the GUI to display not the local player (You) cash, but the other players cash.

So where do i put your PlayerList code at? Anywhere at the Top of my script?

Inside refreshplayerlist function

2 Likes

Alright ill publish and test it with my alt account right now.

Alright i tested and it is NOT working


I have 961.2K cash
TercelGroup2 has 1.8K cash.

On my alt account it is displaying that we both have 1.8K cash

I hope this photo explains things more

Okay I see now (fr this time). You’re defining the variable “Cash”’s path like this:

local Cash = player:WaitForChild(“leaderstat”).Cash

It should be this instead, under “CurrentPlayer”:

local Cash = game.Players[CurrentPlayer.Name].leaderstat.Cash

If you want a detailed explanation, ChatGPT defined “player” as game.Players.LocalPlayer (YOUR PLAYER). So for example, on Player1’s screen both names on the leaderboard would be “Player1”. So that’s why I changed it to a square brace reference (forgot what it was called lol).

EDIT: It’s called Bracket Notation :sweat_smile:

2 Likes

I thought it was going to work but now the whole GUI wont appear.
Screenshot (21)

This is how the script looks like. (In case i did not put the code in the right location)

Maybe try removing the “.Name” from the snippet of code I just gave you.

2 Likes

The GUI still does not appear in my screen.

I think it could be like this because of the code at the bottom of the function

Cash.Changed:Connect(function()
– Update the cash value whenever it changes
PlayerName.Text = CurrentPlayer.Name … " $" … tostring(Cash.Value)

1 Like

Check if the gui exists in first place, Play the game then open explore then top on players select yourself and open PlayerGui and show us if it’s there.

1 Like

It is the “UI”

1 Like

Maybe your ui is offsetted? Try to scale it if you didn’t.

1 Like