hi, im making a fnaf fangame and im trying to make a system where after a while a script will choose between a random of 2+ rooms and then teleport the animatronic / rig to that part facing the same way the part is and then loop the whole script, here is my script I have so far
local bot = workspace.Bots.Caleb local Start = script.Parent.Test1 local test2 = script.Parent.Test2 local test3 = script.Parent.Test3 local room = Start local roomOption = nil wait(3) -- how long to wait until they start moving room = Start -- setting the current room they're in roomOption = math.random(1,2) -- chooses a random room while true do -- starts the loop if room == Start then -- checks if the room they are currently in is the starting room if roomOption == 1 then -- if the room option is 1 bot.HumanoidRootPart.CFrame.Position = test2.Vector3 -- go to that part bot.HumanoidRootPart.CFrame.LookVector = test2.Vector3 -- face the same way as that part wait(math.random(7,12)) -- wait for a random amount of time nextroom = math.random(1,3) -- sees what the next room is else if roomOption == 2 then -- the same as above bot.HumanoidRootPart.CFrame.Position = test3.Vector3 bot.HumanoidRootPart.CFrame.LookVector = test3.Vector3 wait(math.random(7,12)) nextroom = math.random(1,3) end end end end
is there anyway anyone could help
THIS IS NOT A PROPER ANSWER. PLEASE IF YOU KNOW HOW TO MAKE AN ACTUAL AI ANSWER TO HELP THIS PERSON!!
I'm not too advanced with this kind of stuff, so I made a quick tutorial explaining FNAF AI.
I don't really know what to do for code, so another answer can explain that. (Don't accept this as an answer, as it isn't at all a proper answer)