So basically I am making this game called "Pet Rock Simulator". To buy a pet you need to click on a button, but I don't want that button to show until the player has enough money to buy it.
How do I make a gui dissapear if money is not high enough to click on it?
1 answer
In order to do something of this nature, I assume you have some type of stat value that represents your money, you would need to connect a function to a money.Changed event. Within the function, you can expect something within the nature of If money.Value == 'however much you want it to be' then gui.Visible = true/false
I will edit this answer so i can go more in depth for you:
You have some type of leaderboard script that determines your money right?, if so, from a local script you can define a few varibles, such as : local player = game.Players.LocalPlayer; local stats = player:WaitForChild("whatever you named your leaderstats")
and ofc define your gui element you want to make invisible, which is most likely the parent of your script right now. next you can create a local function that will keep track of your money:
local function moneyChange() if money.Value >= entervalhere then guielement.Visible = true/false
and then you can hook it up to:
money.Changed:Connect(moneyChange)
Of course what i gave you is pseudo code and it wont just function if you copy and paste this ive just merely layed out what you have to do. I hope this helps you and if you still run into problems contact me on my roblox profile and i can help you more with this and other problems you may have.
4 comments
ok thank you
if you have any trouble setting it up please dont hesitate to let me know and ill help you out more in depth
I am currently having a bit of trouble setting the invisible gui, could you please go more in depth with it as I am a beginner and I don't know much, thanks.
check my edited answer
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Make sure that your checking the money on a normal script,