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

My leaderstats :GetPropertyChangedSignal() doesn't work. Why?

I have a leaderboard script that inserts a folder called leaderstats. It also inserts a value called Money. I already have a "fake" money value in ServerStorage. That fake money value is actually real. So, back to the main thing here. I have a part in the script that says

 local money = game.ServerStorage.PlayerStats:FindFirstChild(player.Name)
	money:GetPropertyChangedSignal("Value"):Connect(function()
		cash.Value = money.Value
	end)


And yes, the leaderstats cash has a variable called Cash, if you were wondering. For some reason, when the money's value changes, the leaderstats cash doesn't change. Any help is appreciated. Here's the rest of the script:

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder",player)
	leaderstats.Name = "leaderstats"
	local cash = Instance.new("NumberValue",leaderstats)
	cash.Name = "Money"
	
	local money = game.ServerStorage.PlayerStats:FindFirstChild(player.Name)
	money:GetPropertyChangedSignal("Value"):Connect(function()
		cash.Value = money.Value
	end)
end)

Any help is good

2 comments

0

It works for me. Are there any errors? Is this a local script or a server (normal) script?

0

Server script

1 answer

✓ Accepted answer

Syntax problems

Use this instead

local money = game.ServerStorage.PlayerStats:FindFirstChild(player.Name)

money:GetPropertyChangedSignal("Value"):Connect(function()

    cash.Value = money.Value
end)

Use this


game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder",player)
    leaderstats.Name = "leaderstats"
    local cash = Instance.new("NumberValue",leaderstats)
    cash.Name = "Money"

    local money = game.ServerStorage.PlayerStats:FindFirstChild(player.Name)
    money:GetPropertyChangedSignal("Value"):Connect(function()
        cash.Value = money.Value
    end)
end)

If it didn’t work.The script might be in the wrong place.

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