Money GUI Updating?

I want to update the GUI whenever the players money changes.

local gui = script.Parent
local text = gui.Dosh.Text

local player = gui.Parent.Parent.Parent

local dosh = player:WaitForChild("Dosh")

dosh.Changed:Connect(function()
	print("working")
	text = dosh.Value
end)

This is the script I am using to try and make this work.

However, the text does not update whenever the player’s money changes, and there are no errors.

3 Likes

this should be a LocalScript in the gui

local Player = game.Players.LocalPlayer -- Get player like this instead
local PlayerDosh = Player:WaitForChild("Dosh")
local DoshDisplay = script.Parent:WaitForChild("Dosh")

PlayerDosh:GetPropertyChangedSignal("Value"):Connect(function()
  DoshDisplay.Text = PlayerDosh.Value -- Change properties like this
end)

(i forgot to rename Dosh → PlayerDosh if you already copied)

5 Likes

I get the following error:
GetAttributeChangedSignal is not a valid member of RBXScriptSignal - Client - LocalScript:5

2 Likes

remove .Changed
i wrote it on the website pretty quickly

local Player = game.Players.LocalPlayer -- Get player like this instead
local PlayerDosh = Player:WaitForChild("Dosh")
local DoshDisplay = script.Parent:WaitForChild("Dosh")

PlayerDosh:GetPropertyChangedSignal("Value"):Connect(function()
  DoshDisplay.Text = PlayerDosh.Value -- Change properties like this
end)
3 Likes

I tried running this and adding a Print("TEST") within the changed function, and it doesn’t display in output.

PlayerDosh:GetAttributeChangedSignal("Value"):Connect(function()
	DoshDisplay.Text = PlayerDosh.Value -- Change properties like this
	print("TEST")
end)

I believe it’s not picking up whenever the players dosh changes.

3 Likes

I think yall meant to type GetPropertyChangedSignal.

Btw, the .Changed signal on ValueObjects refers to whenever .Value is changed.

5 Likes

not sure why i wrote Attribute

2 Likes

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