How can I make a FNAF AI system?

Hello, as you can see in the title, I want to make a FNAF AI system and I don’t know how. I searched in devforum for someone that already posted the same question as me but everything I found wasn’t very useful. I don’t want a script, but I want advice and what to use so I can start making the script and make it my self. Thanks!

This is how it’s done in fnaf 1

So to put it into roblox you would have to setup positions where the animatronics can be and connect those positions in some way. And then implement the random moving from the link.

How can I make the moving though? Is there any specific thing I can use on my script so I can make random movement?

Have a max time and a minimun time for each enemy, have a random wait time (task.wait(math.random(minwait, maxwait))) and then randomly generate a success number, if the success number is less than a number, the move succeeds, and then their position will move up.

So some code would look something like this:

-- This is for each enemy, and is only example code, actually dont use it.
local Enemy = workspace.Enemy

local MinMoveTime = 2
local MaxMoveTime = 10

local CurrentEnemyPosition = 1
local FinalEnemyPosition = 7

repeat
task.wait(math.random(MinMoveTime, MaxMoveTime))
local success = math.random(1, 10)
if success < 3 then
CurrentEnemyPosition += 1
Enemy:SetPrimaryPartCFrame(workspace.EnemyLocations['Position'..CurrentEnemyPosition]) -- Example position name: Position2
end
end
until CurrentEnemyPosition == FinalEnemyPosition

-- jumpscare stuff here
2 Likes

what is exactly the workspace.EnemyLocations?

It would be a folder in workspace, with parts inside of it that will be the positions (on the cameras) that the enemies move to.

Again, my code is example code and should not be used.

1 Like

I made a module script with the cframes inside it, should I keep that or use the parts?

And kind of cframe should work fine, so the module script should work fine, as long as you get the cframes from that.

I’ll see what I can do and after I’m done I’ll tell you if it worked, thanks!

1 Like