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

How to I print a player's money balance?

Hello, I am having trouble with a Server Script that I am doing, it is a Regular script and I keep getting an error like, "leaderstats is not a valid member of Player". It would be appreciated if you would be able to find the error, and by the way, do not recommend the Scripting Helper's discord.

game.Players.PlayerAdded:Connect(function(Plr)
	print(Plr.Name.. " has empty data!")
	print(Plr.Name.. " Has loaded in!")
	print(Plr.Name.. "'s balance is $"..Plr.leaderstats.Cash.Value)
end)

2 comments

0

try doing Plr:FindFirstChild("leaderstats").Cash.Value

0

Start the game on Studio, and then open the player folder, look inside your player, and check the object that is used for leaderstats

1 answer

game.Players.PlayerAdded:Connect(function(Plr)
    print(Plr.Name.. " has empty data!")
    print(Plr.Name.. " Has loaded in!")
    print(Plr.Name.. "'s balance is $"..Plr:WaitForChild("leaderstats"):WaitForChild("Cash").Value)
end)

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