Money Label from Leaderstats Value

Hi! So I am having trouble with something. I want to make it to where once someone joins the game, or the value of cash changes, the label on the top right changes to that amount, which is the money label to let you know how much you have. What is wrong with my script? This is based on the leaderstats usage of Cash values

local Players = game:GetService("Players")
local leaderstats = Players.LocalPlayer:WaitForChild("leaderstats")
local MoneyText = script.Parent.TextLabel
local MoneyInt = leaderstats:WaitForChild("Cash")

Players.PlayerAdded:Connect(function(player)
	MoneyText.Text = MoneyInt.Value
end)

MoneyInt.Changed:Connect(function()
	MoneyText.Text = MoneyInt.Value
end)

You are only updating the money of your own player

Is the error that the text label doesn’t show the player’s cash amount when they join?

If so, try this script:

local Players = game:GetService("Players")
local leaderstats = Players.LocalPlayer:WaitForChild("leaderstats")
local MoneyText = script.Parent.TextLabel --where the text label is
local MoneyInt = leaderstats:WaitForChild("Cash")

MoneyText.Text = MoneyInt.Value

MoneyInt.Changed:Connect(function()
	MoneyText.Text = MoneyInt.Value
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.