For some reason, theres some issue in this chunk of code thats causing the value to reset for seemingly no reason. I know its an issue within this chunk of code as the issue still persists even when completely isolated
Mood = 1
CurrentComment = "%2Test"
local First = string.sub(CurrentComment,0,1)
if First == "%" then
local Mood = tonumber(string.sub(CurrentComment,2,2))
print(Mood.. " Check A")
if Mood == nil then
--Placeholder for other code, its not the cause of this behavior
else
CurrentComment = string.sub(CurrentComment,3,-1) -- This line is also not the cause
Mood = (2*Mood)-1
print(Mood.. " Check B")
end
end
print(Mood.." Check C")
Check A = 2
Check B = 3
Check C = 1/Whatever the default mood is