I need alot of help on upgrade script

Hello, thanks for reading. I am facing a complex problem (for me), because I have no understanding of how to make this, and I require a script from someone else for this, or I simply cannot make this. It sounds easy though.

My idea: I am making a game with hammers (what we need to know for this issue) and smashpoints (currency) You start our for a lvl1 hammer upgradable by 1 upwards to lvl 3. I have a gui with an upgrade button. If you press it, it takes an amount of currency from you, and upgrades a stat in the player by 1. (200 coins for lvl2 600 coins for lvl3)

I don’t know if I explained it correctly, but I need someone to make me a script that runs when a button is pressed (make it anything you want, I can edit it) and it contains a code that checks if the player has the required amount of coins to upgrade, and if they do, it removes the coins and adds +1 to plr.HammerLevel

Roblox has stated here on the DevForum that you cannot ask people to write an entire script for you.
Though, I will show you what you can try.
If plr.hammerLevel is in the players leaderstats, Then you could do something like

plr.leaderstats.HammerLevel.Value = plr.leaderstats.HammerLevel.Value + 1

For the button (i think you know how to detect when its pressed)

if plr.leaderstats.SmashPoints.Value >= --insert needed value) then
plr.leaderstats.HammerLevel.Value = plr.leaderstats.HammerLevel.Value + 1
plr.leaderstats.SmashPoints.Value = plr.leaderstats.SmashPoints.Value - -- the number you want to take away
end

As i stated, I cannot create a full script for you, But this is basically all i can do.
If this doesnt work, Try searching it up
This video could help

Or try searching it up somewhere else, Maybe even here on the dev forum.

Thanks very much for your help and the time you took to do this.

Thank you for telling me this, I never knew about this.

I’ll watch the video! Hopefully it works

Of course, I hope this helps you.

Good luck with your game! It sounds pretty fun!

Thank you, if you want to know more about our game use this link:

I don’t know if you’re interested, but it’s currently a baseplate with most features made

Eh, i love trying new games, I’ll definitely try it out whenever it releases.

2 Likes

Alright, I’ll send you a DM when it finishes, but it will likely take a long time.

And again, I really appreciate your help

1 Like