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

Need help with if you dont have enough cash you can not click the gui button can someone help?

Asked by 2 years ago
Edited by ScriptGuider 2 years ago

so what im trying to do is, is that i need to make it so if you dont have enough cash the button is not active. I tried this but it did not work

1local currencyNeeded = 10          
2local plr = game.Players:GetPlayerFromCharacter()
3 
4 
5if plr.leaderstats.Cash.Value >= currencyNeeded then
6    game.StarterGui.PlacementGui.Frame.Ranged.Active = true
7else
8    game.StarterGui.PlacementGui.Frame.Ranged.Active = false
9end
0
What type of script are you using to do this? local or normal? Codyslx 0 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

You are editing the active value in startergui instead of the player's gui. Instead, use plr.PlayerGui, like this.

1local currencyNeeded = 10          
2local plr = game.Players:GetPlayerFromCharacter()
3 
4 
5if plr.leaderstats.Cash.Value >= currencyNeeded then
6    plr.PlayerGui.PlacementGui.Frame.Ranged.Active = true
7else
8    plr.PlayerGui.PlacementGui.Frame.Ranged.Active = false
9end

Let me know if this helps.

Ad

Answer this question