Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a Upgrade in a Tycoon?

Asked by 10 years ago

I have a button to buy a drill and a upgrade to upgrade the drill. But people can just buy the upgrade before the drill.

How can I make it so you have to buy the drill for the upgrade button to exist?

Please help

Dear Moderator, This question should not be removed because it is something many people wonder. Thank you

3 answers

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

There are two ways really to go about it.

The first is to make the second button only appear as a result of buying the first item. A really, really simple way to do that is to just make it part of the purchase that appears (this could get messy). A slightly cleaner way would be to just do a second procedure separate from the purchase which makes it visible or moves it to a certain place, etcetera.

The second way is to make the second button check whether or not the first has been bought, in addition to checking if you have enough money. This could be done simply by searching for whether or not the purchase exists (if MyTycoon:FindFirstChild("LowLevelPurchase") and EnoughMoneyCheckHere then). You could also specifically track the existence of the purchase using Boolean Value objects either in the tycoon, or in either button, or by doing an equivalent storage in _G.

The second way overall is much cleaner and easier to debug since you do not have new things being introduced midway through playthrough. On the other hand it does require some form of communication between things; using the child-existence check would require no new infrastructure though, so if that is the problem you can go in that direction.

Ad
Log in to vote
0
Answered by 10 years ago

Put the button inside the model for the drill. That way, when you move the model from lighting, the button appears.

Log in to vote
0
Answered by 10 years ago

Easier way to just buy the button with the item from the previous button instead.

Answer this question