You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to make a movement script for bonnie in my fnaf game.
-
What is the issue? The CAM 3 move in my fnaf bonnie script isn’t working.
-
What solutions have you tried so far? I analyzed my code for hours and I can’t figure out why it isn’t working
When bonnie is at cam 3, I want him to go back to cam 2a. But when he gets there he doesn’t move even after waiting longer than the random wait interval. I included the whole movement function because I don’t know where the problem is.
local moveableCameras = {
cam1A = Vector3.new(-12.7, 6.92, -65.9),
cam1B = Vector3.new(-12, 5.92, -41.4),
cam2A = Vector3.new(-18, 5.92, -14.7),
cam2B = Vector3.new(-30.3, 5.92, -7.4),
cam3 = Vector3.new(-30.3, 5.92, -7.4),
cam5 = Vector3.new(-34, 5.92, -51.3)
}
local function movement()
if HRP.Position == moveableCameras.cam1A then
HRP.Position = moveableCameras.cam1B
HRP.Orientation = Vector3.new(0, 0, 0)
wait(math.random(20, 60))
movement()
elseif HRP.Position == moveableCameras.cam1B then
local rng = math.random(1, 2)
if rng == 1 then
HRP.Position = moveableCameras.cam5
HRP.Orientation = Vector3.new(0, -180, 0)
wait(math.random(20, 60))
movement()
elseif rng == 2 then
HRP.Position = moveableCameras.cam2A
HRP.Orientation = Vector3.new(0, -180, 0)
wait(math.random(20, 60))
movement()
end
elseif HRP.Position == moveableCameras.cam2A then
local rng = math.random(1, 2)
if rng == 1 then
HRP.Position = moveableCameras.cam3
HRP.Orientation = Vector3.new(0, -90, 0)
wait(math.random(20, 60))
movement()
elseif rng == 2 then
HRP.Position = moveableCameras.cam2B
HRP.Orientation = Vector3.new(0, 0, 0)
wait(math.random(20, 60))
movement()
end
elseif HRP.Position == moveableCameras.cam2B then
wait(math.random(20, 60))
attack()
elseif HRP.Position == moveableCameras.cam3 then
HRP.Position = moveableCameras.cam2A
HRP.Orientation = Vector3.new(0, -180, 0)
wait(math.random(20, 60))
movement()
elseif HRP.Position == moveableCameras.cam5 then
HRP.Position = moveableCameras.cam1B
HRP.Orientation = Vector3.new(0, 0, 0)
wait(math.random(20, 60))
movement()
end
end