How to make a update button

Hello i am making a tower battles game and i want to know how to make it like when we click a tower a gui comes up and we click upgrade it it takes money and then damage increases and the troop looks better?

The devforum is not meant for people to give out entire scripts. Have you tried this on your own? Have you looked at other resources? Have you done some research? Try doing all those things before asking for entire scripts.

2 Likes

You should make it where when the player clicks the tower bind it to a mouse detector event then use :MouseClick() s first parameter to treat it as the local player. From then everything is relative on how you program your currency/damage systems.

1 Like

Like @MegaFireball0 said, don’t ask people to give entire scripts. But also, don’t make another topic about the same topic like you did with this one:

1 Like

i am very new to devforum thanks for telling wont do it again

due to spelling error it seems like it says i am asking for an entire script while i meant to say that i just wanna know how to do it

No worries, just make sure you read this:

1 Like

thank you ill try to best to abide by the rules

bruh sorry but looks like you misread i meant to say do not give entire scripts it got me a spelling error sorry for the misunderstanding

In that case make a click detector and sense when it is clicked by using .MouseClick. Then from there get the new troop and destroy the old troop. Change whatever else your using for the health and damage. For the lowering the money use something like this: player.leaderstats.Money = player.leaderstats.Money

1 Like

so you mean like i make a variable for health and then do destroy function and then some load like function to get the new troop in?

It’s alright buddy. Like the others suggested though, you will need a basic understanding of scripting before doing things like this. I’ll link some things that can help you with the development of your game:

These are optional but are highly recommended to make your game semi-exploit proof.

2 Likes

Do something like this.

Tower.ClickDetector.MouseClick:Connect(function(player)
if player.leaderstats.Money = 50 then
player.leaderstats.Money =player.leaderstats.Money - 50
local troop = Tower.Troop
troop:Destroy()
local newtroop = game.ReplicatedStorage.UpgradedTroop:Clone()
newtroop.Parent = workspace
end)

Then use CFrames to change the troops position.

2 Likes