#Upgrades problem with leaderstats

1 messages · Page 1 of 1 (latest)

slow orbit
#

Im making Clicker Game For Educational Purposes. I used leaderstats to track the money that you get from click on specific part. i made upgrade with ui. he doubles the money gained from one click and costs 300 money but when i buy it it gets my 300 money but when i click on the part the game gives back my 300 money and i dont get 2x money
Please Help

verbal idolBOT
#

studio** You are now Level 1! **studio

slow orbit
west tide
# slow orbit Im making Clicker Game For Educational Purposes. I used leaderstats to track the...

@slow orbit

The reason why the code isn't functioning properly is that you are decrementingmoney and incrementing stages on the client. Since these changes are only happening on the client, the server does not recognize them, which causes inconsistencies in gameplay.
cf. LocalScript in ImageButton

You should have a remote call that invokes the server, which then checks if the money is indeed more than 300 and increments the stage while decrementing the money variables accordingly.

cf. https://create.roblox.com/docs/projects/client-server - Roblox's replication model
cf. https://create.roblox.com/docs/scripting/events/remote - Roblox's client-server communication model

slow orbit
#

it worked