shockaloc
(shockaloc)
January 12, 2024, 1:20pm
#1
if math.round(frame.Size.X.Scale * 10) == 64 then
print("Ran out of stamina")
else
print("Still have stamina")
end
im tryin to make an if statement that says if the frame = a certain size then it’ll print ran out of stamina but it only prints still have stamina. whats wrong with my code?
and before the if statement i have a tween which will set its size to (0, 64,0, 100)
azqjanna
(azqjanna)
January 12, 2024, 1:29pm
#2
Did you mean X.Offset? For this to work right now the first number in the size has to be 6.4
1 Like
shockaloc
(shockaloc)
January 12, 2024, 1:30pm
#3
didnt know i had to put offset
shockaloc
(shockaloc)
January 12, 2024, 1:34pm
#4
i changed it to
if math.round(frame.Size.X.Offset * 10) == 64 then
it still doesnt work
Print(math.round(frame.Size.X.Offset * 10))
To see what your getting.
shockaloc
(shockaloc)
January 12, 2024, 1:49pm
#6
6740 and dang i never new you could do that
Prints will help you fix so much!
When having issues add prints after/before if statements to make sure you are getting what you’re asking
shockaloc
(shockaloc)
January 12, 2024, 1:51pm
#9
thank you so much for helping and why the flip does my statements have to be “number” of characters long
So if you get rid of the *10 will it work?
shockaloc
(shockaloc)
January 12, 2024, 1:55pm
#11
i have no idea and im sorry that i have to say it so drawn out if i dont roblox wont let me talk
You need to also divide the result by 10 to round the number to 1 decimal place like so:
if math.round(frame.Size.X.Offset * 10) / 10 == 64 then
print("Ran out of stamina")
else
print("Still have stamina")
end
And also use the offset like @azqjanna correctly suggested