enabled = true script.Parent.Touched:connect(function(hit) humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil and enabled == true then enabled = false player = game.Players:GetPlayerFromCharacter(hit.Parent) cash = player.leaderstats.Points cash.Value = cash.Value + 50000 wait(10) enabled = true end end)
This is a script i made for a tycoon. I have cash on the leaderboard, the dropper adds cash to a block, i can collect that cash, and it works with the upgrade buttons, but when i touch the brick to give me cash, the separate brick, it gives me 50,000 cash, but it doesn't save. So say i have 10 cash from the amount the dropper gave me, and then i go onto the brick that gives me 50,000 cash, it adds to the leaderboard, but then if i go get the cash from the dropper, say like 10 more cash, it switches from 50,010, to just 20. How do i fix this?
It only changes the value in the leaderstats, if it changes from 50,010 to 20 then there's another object where the real cash is stored. When that object's value changes, it will also change the value on the leaderboard.