I'm making a gui lock script where if you have under a certain amount of cash, an upgrade button would say 'LOCKED' and if it went over, it would say what the upgrade is and stuff..
Part of the script works... only the first part where it says that the upgrade is locked, but the other half won't work and there is NO errors in the output...
anyways, here's the lock script (local script inside screen gui)
local upg5T = script.Parent.upg5 local plr = game.Players.LocalPlayer if plr.leaderstats.Cash.Value < 150000 then upg5T.Text = "LOCKED" elseif plr.leaderstats.Cash.Value > 150000 then upg5T.Text = "UNLOCKED" wait(2) upg5T.Text = "blabla" if plr.leaderstats.Cash.Value < 150000 then upg5T.Text = "blabla" end end
You're just checking the value once the script runs, that is why it is not working, What you have to do is the event called ".Changed" That runs everytime the value changed, so it would be:
local upg5T = script.Parent.upg5 local plr = game.Players.LocalPlayer plr.leaderstats.Cash.Changed:Connect(function() if plr.leaderstats.Cash.Value < 150000 then upg5T.Text = "LOCKED" elseif plr.leaderstats.Cash.Value >= 150000 then upg5T.Text = "UNLOCKED" wait(2) upg5T.Text = "blabla" end end)
This will check everytime that value changed, I hope I helped. If you got any question, Reply me.