So, Ya im trying to set a limit so i cant the units value cant get over 50 this is wat i got so far . I dont know why its not working thats the hole script and this the part with "If Units.Value == 50 then Units.Value = Units.Value - 10" its there the limit im trying to set is not working.
Cash = Player.leaderstats.Cash
Units = Player.leaderstats.Units
function onClick()
if Cash.Value >= 20 then
Cash.Value = Cash.Value - 20
Units.Value = Units.Value + 1
local Barbarian = game.Lighting.Barbarian:clone()
end
if Units.Value == 50 then
Units.Value = Units.Value - 10
end
if Cash.Value <= 20 then
script.Parent.NotEnough.Visible = true
wait(2)
script.Parent.NotEnough.Visible = false
end
end
script.Parent.MouseButton1Click:connect(onClick)

3 comments
Change line 10 to: "if Units.Value > 50 then" (without the quotation marks, ofc). Also fix your grammar so others can understand you better.
I'd suggest checking your grammar on this question. I wish I could answer it, but you've made some grammar errors.
got it working thanks "TheDeadlyPanther"