You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make it so that the higher an animatronics level is the quicker they move around. So for example, if the animatronic level is the max (20) then it takes anywhere from 1-3 seconds to move around. And if the animatronic level is low (5) then it takes anywhere from 30-40 seconds to move around. These are just examples Btw this might help with the AI levels every night : Steam Community :: Guide :: Ultimate AI Breakdown for FNAF 1
What is the issue? Include screenshots / videos if possible!
I don’t know how to make it so that the higher the level the quicker they move, i’ve tried it before
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried YT and Devforum
There could be some ways to tackle this issue, but it all just depends on how you make them move.
If there is a specific window of time in seconds that their movement gets activated, you could do something along the lines of;
local gameDifficulty = 20 --//edit this to the difficulty picked
while true do --//time between movements
local moveTimer = math.random(30, 40) --//every 30 to 40 seconds they move
if moveTimer - (gameDifficulty * 1.5) == 0 then --//if the sum is 30 - 20*1.5 (30) then..
moveTimer += 1 --//..add a second
end
task.wait(moveTimer - (gameDifficulty * 1.5)) --//wait the calculated time
print(moveTimer - (gameDifficulty * 1.5)) --//check to see what the interval was
--//move the animatronic
end
If you want the gameplay to be a bit more erratic and randomized, then make use of the math.random interfaces. If that is unnecessary then you can simply remove them to keep a linear movement pattern.
Edit: I fixed the code and added extra checks to make sure it doesn’t equal to 0. This will now output a 1 to 10 second wait.