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

Doesn't seem to save up on the leaderboard, answer?

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?

3 comments

0

Nothing looks wrong with this script. Share the script for the collecting the dropper cash.

0

I agree, nothing's wrong with your script :P

0

But it doesn't save it, it just shows it but it really didn't change the actual value, like I said

1 answer

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.

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