Calling a string of numbers with Math.Random

I have a math.random calling a number between 1 and 25. If it lands on any number between 1 and 11 I want it to do blank. Is there and easy way to write this without 25 elseif statements?

Code that doesn’t work:

while true do

	wait(.5)
	stage = math.random(1,25)

	if stage == 11-24 then
		print("Night!")
		night()
	elseif stage == 1-10 then
		print("Day!")
		day()
	elseif stage == 25 then
		print("STORM!")
		storm()
	end
end
2 Likes

If you say 11-24 it means 11 minus 24 not 11 to 24. Instead do (I’m on phone so you might need to change some stuff)

if stage >= 11 and stage =< 24 ( if stage is larger or equal to 11 and less than or equal to 24)

Repeat this for the second part as well but for the last it should work

3 Likes

This works. Thank you for helping.

1 Like