Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i fix this path finding error for the AI of my character?

So i was making a piggy style game, and when i was making the path finding of my character, it gaved me this error: Workspace.Blanky.AI:99: invalid argument #2 to 'random' (interval is empty)

i tried the script on a new save and it worked. Also in the map that im using already has the lobby with it's gui, but i can't find any difference between the script on the baseplate and the script in the game, do you know how can i fix it?

2 comments

0

Are you coding it yourself? This seems like a pretty easy error to fix if you were.

0

I didn't come it myself, it was from a tutorial but I'm learning from them, the hard part is to understand what's wrong with the code.

1 answer

✓ Accepted answer

On line 99 inside the script named "AI" you have an error with the function math.random. Interval empty usually means you gave it a variable that wasn't a number, is too large, etc.

You could fix this by making sure whichever arguments you are giving it are valid numbers.

examples of math.random:

math.random() -- random integer between 0 and 1
math.random(m) -- random integer between 1 and m
math.random(m, n) -- random integer between m and n

You can find more information on math.random on the developer hub.

This discussion is preserved as it was. New answers, comments, and votes are closed.