So this is a pretty easy fix, just change :GetPropertyChangedSignal
to .Changed
.
Here's the code I typed up:
01 | local player = game.Players.LocalPlayer |
02 | local leaderStats = player:WaitForChild( "leaderstats" ) |
03 | local gold = leaderStats:WaitForChild( "Gold" ) |
06 | script.Parent.Text = 'Gold: ' .. tostring (gold.Value) |
08 | gold.Changed:Connect( function () |
09 | script.Parent.Text = "Gold: " .. tostring (gold.Value) |
I tested it in-game with this leaderstats script and it worked just fine for me:
01 | game:GetService( 'Players' ).PlayerAdded:Connect( function (player) |
02 | local character = player.Character or player.CharacterAdded:Wait() |
03 | local humanoid = character:FindFirstChildOfClass( 'Humanoid' ) |
05 | local leaderstats = Instance.new( 'Folder' ) |
06 | leaderstats.Name = 'leaderstats' |
07 | leaderstats.Parent = player |
09 | local gold = Instance.new( 'IntValue' ) |
11 | gold.Parent = leaderstats |
17 | gold.Value = gold.Value + 1 |