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

The Cash GUI doesn't change when the player's cash increases, why?

local player = game.Players.LocalPlayer
local cash = player.leaderstats.Cash

while true do
  wait()
  script.Parent.Text = "Cash: "..cash.Value
end

Are there any mistakes or anything?

I put this script in the textlabel.

1 comment

0

try putting brackets like this: script.Parent.Text = ( "Cash: "..cash.Value)

1 answer

✓ Accepted answer

Using a loop is really bad because I once used too many loops and it crashed. I have been taught the .Changed:connect:function() method.

Make sure this is a local script in the text label;

local player = game.Players.LocalPlayer
local cash = player:WaitForChild("leaderstats").cash
local textlabel = script.Parent

textlabel.Text = cash.Value --When player joins they need to see their cash

cash.Changed:connect(function(Value) --FUNCTIONS WHEN CASH IS CHANGED
	textlabel.Text = cash.Value
end)

If any other help is needed comment down below. Please upvote and accept answer if helped.

2 comments

0

Thanks alot :) It works.

0

np

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