Attempt to compare number <= nil

Clearly something is wrong here as I am getting an error.

I’m trying to pass this variable into a function inside my modulescript function, yet my script does not recognize it.

AIlevel is a variable but you are shadowing it with a function parameter that I have to assume you aren’t calling.

you can change local funciton MovementChance(AIlevel) to just local function MovementChance()

Inserting --!strict at the very top of your script will help catch issues like these.

1 Like

Try doing:

until tonumber(AIlevel) >= number