if Level.Value < BaseStats.MaxLevel then
print("ItsLower")
if Player.PlrStats.Experience.Value >= Player.PlrStats.ExperienceNeed.Value then
Level.Value = Level.Value + 1
print("ok")
Experience.Value = Experience.Value - ExperienceNeed.Value
end
end
Hello, so i have this script, it works and prints “ItsLower” because the value is smaller. But for some reason the Exp if statement doesn’t work even though i literally look and Exp was greater than ExpNeed. And theres no output or anything, and i have 0 idea why it wont work
if Level.Value < BaseStats.MaxLevel then
print("ItsLower")
if Player.PlrStats.Experience.Value >= Player.PlrStats.ExperienceNeed.Value then
Level.Value += 1
print("ok")
Experience.Value -= ExperienceNeed.Value
end
end
If you want to debug it, do print(Player.PlrStats.Experience.Value >= Player.PlrStats.ExperienceNeed.Value)
like this:
if Level.Value < BaseStats.MaxLevel then
print(Player.PlrStats.Experience.Value >= Player.PlrStats.ExperienceNeed.Value)
if Player.PlrStats.Experience.Value >= Player.PlrStats.ExperienceNeed.Value then
Level.Value += 1
print("ok")
Experience.Value -= ExperienceNeed.Value
end
end
One or both of the values you provided is incorrect. meaning it is always false
Edit: Great, Now I’m forced to keep that mistake there for FOURTEEN HOURS
You said the print returns “false” meaning that, one of your values is skewed. and because it returns false, it never runs the code in the if statement.
Yes, if i start it off by checking if its less than(which by default it is) it prints, but for some reason when i change it doesnt update or smth with the script(btw this is in a serverscript if that changes anything)
function NewLevel()
if Level.Value < BaseStats.MaxLevel then
print(Player.PlrStats.Experience.Value >= Player.PlrStats.ExperienceNeed.Value)
if Player.PlrStats.Experience.Value >= Player.PlrStats.ExperienceNeed.Value then
Level.Value += 1
print(“ok”)
Experience.Value -= ExperienceNeed.Value
end
end
end
Experience.Changed:Connect(NewLevel)