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
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.