Im trying to make my textlabel become invisible if Stat > 1. Here is the code.
p = game.Players.LocalPlayer while true do wait() if p.bin.StatPoints.Value >= 1 then script.Parent.Visible = nil elseif p.bin.StatPoints.Value <= 1 then script.Parent.Visible = true end end
You might want to considering limiting your use to infinite loops whenever possible. You could track changes to properties of an object use the Changed event, which is a lot more efficient.
You also made a little error in checking the value of StatPoints on line 5 ( >1=)
Finally if on one line you are checking for (greater than or equal to) and on the other you are checking (less than or equal to), both statements would be true, therefore both different codes would run
player = game.Players.LocalPlayer statsBin = player:WaitForChild('bin') statPoints = statsBin:WaitForChild('StatPoints') statPoints.Changed:connect(function (property) -- wait for change in object `statPoints` if tostring(property) == 'Value' then -- if change is its Value property if statPoints[property] > 1 then --if value is over one do script.Parent.Visible = false elseif statPoints[property] < 1 then --if value is less than 1 do scrippt.Parent.Visible = true end end end)