Trying to understand a simple math print script, Need a little help

I am trying to make the script print “We reached the end!” when a == 5, but for some reason it isn’t working. It just keep printing “We are not there yet.” even after it passes 5 times. Can someone please help?

while true do
	wait(2)
	local a = 1
	local b = 1
	
	if a == 5 then
		print("We reached the end!")
	else
		print("We are not there yet.")
	end
end

I also want it to stop after it reaches 5 but I’m not sure how it works.

Because you are only checking if a is exactly equal to 5.
also, you arent adding the number.

use math.min

math.min(5, a + 1)

What does math.min do? I want to understand every part so I don’t get confused in the future

._.
min
minimum
minimum number
gets minimum number
can be used as a upper limit
that simple
roblox says it as well.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.