Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

local currencyNeeded = 10 			
local plr = game.Players:GetPlayerFromCharacter()


if plr.leaderstats.Cash.Value >= currencyNeeded then 
	game.StarterGui.PlacementGui.Frame.Ranged.Active = true
else
	game.StarterGui.PlacementGui.Frame.Ranged.Active = false
end

1 comment

0

What type of script are you using to do this? local or normal?

1 answer

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

local currencyNeeded = 10           
local plr = game.Players:GetPlayerFromCharacter()


if plr.leaderstats.Cash.Value >= currencyNeeded then 
    plr.PlayerGui.PlacementGui.Frame.Ranged.Active = true
else
    plr.PlayerGui.PlacementGui.Frame.Ranged.Active = false
end

Let me know if this helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.