Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

0
It works for me. Are there any errors? Is this a local script or a server (normal) script? User#20279 0 — 5y
0
Server script toman655 58 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Syntax problems

1. Use this instead

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

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

    cash.Value = money.Value
end)

2.

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.

Ad

Answer this question