✓ Accepted answer
So this is a pretty easy fix, just change :GetPropertyChangedSignal to .Changed.
Here's the code I typed up:
local player = game.Players.LocalPlayer
local leaderStats = player:WaitForChild("leaderstats")
local gold = leaderStats:WaitForChild("Gold")
script.Parent.Text = 'Gold: '..tostring(gold.Value)
gold.Changed:Connect(function()
script.Parent.Text = "Gold: "..tostring(gold.Value)
end)
I tested it in-game with this leaderstats script and it worked just fine for me:
game:GetService('Players').PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass('Humanoid')
local leaderstats = Instance.new('Folder')
leaderstats.Name = 'leaderstats'
leaderstats.Parent = player
local gold = Instance.new('IntValue')
gold.Name = 'Gold'
gold.Parent = leaderstats
gold.Value = 1
while true do
wait(1)
gold.Value = gold.Value + 1
end
end)
1 comment
My value is an int value