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

Players are always ending up with 1001 cash?

So I'm making a game where you sell stuff for cash and at first I had this pad the player would stand on to make them sell the item in a return of cash but suddenly it always had the player end up with 1001 cash. I changed this to a click detector button and it is still doing the same. In the leaderstats thing I had the player start with 1000 cash but even if I spent it all down to 200 cash it still, no matter what, brings it all the way back to 1001 cash. Can some one please help I am literally going insane. Here is the click detector button code:

local Button = script.Parent

Button.ClickDetector.MouseClick:Connect(function(player)
	while player.Sodas.Value > 0 do
		player.Sodas.Value = player.Sodas.Value - 1
		player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1
	end
end)

1 answer

The other stuff you're buying to get down to 200 cash is likely all client-side, meaning that when you sell a soda for 1 cash the server thinks you're still at 1000 cash and adds 1 to that. Make your spending scripts server-side.

3 comments

0

But the shop is in a gui and I used a local script, how would I make it actually subtract the cash on the server side?

0

client-server replication

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