I'm trying to make it so that if a player has enough money, and steps on a brick, another brick will appear.
plr = script.Parent.Parent.Parent.Parent.Parent.Parent price = 0 brick = script.Parent.Parent.Parent["Seasoner - 1200"].Head script.Parent.Touched:connect (function() local v = plr.leaderstats.Cash if v.Value >= v.Value - price then brick.transparency = 0 else brick.transparency = 1 end end)
And for some reason this didn't work.
Edit: This is my new script, but it still doesn't work, what's wrong with this one?
plr = script.Parent.Parent.Parent.Parent.Parent.Parent price = 0 brick = script.Parent.Parent.Parent["Seasoner - 1200"].Head script.Parent.Touched:connect (function() local v = plr.leaderstats.Cash if v.Value - price >= 0 then brick.Transparency = 0 else brick.Transparency = 1 end end)
Indentation-wise, else
should be on the same level as its if
.
Your conditional:
v.Value >= v.Value - price
Always evaluates to true, since the value minus the price will always be less than the value alone.
Try using this conditional instead:
v.Value - price >= 0