I made a script that changes a model’s position depending on a variables value. So for example, if the variable has a value of 3, then the model with move to part 3. Basically a five night’s at freddy’s AI, you can search it up to understand more. What I wanna do is depending on the model’s position, it does a different pose. But the only thing I can do is just to move it’s CFrame. How would I be able to make it change the pose depending on the model’s position? Here is the script :
local AI = game.Workspace.abrahamafrica3000
local Door = game.Workspace.Billis.FNaFdoor.OpenDoor
local Positions = {workspace.CheckP1.CFrame,
workspace.CheckP2.CFrame,
workspace.CheckP3.CFrame,
workspace.CheckP4.CFrame,
workspace.CheckP5.CFrame,
workspace.CheckP6.CFrame,
workspace.CheckP7.CFrame,
workspace.CheckP8.CFrame,
workspace.CheckP9.CFrame
}
local PositionValue = 1
repeat
local success = math.random(1, 20)
print(success)
task.wait(4)
if success <= 3 then
PositionValue += 1
end
if PositionValue == 1 then
AI:SetPrimaryPartCFrame(game.Workspace["abrahamafrica3000(2)"]:GetPrimaryPartCFrame())
end
if PositionValue == 2 then
AI:SetPrimaryPartCFrame(Positions[2])
end
if PositionValue == 3 then
AI:SetPrimaryPartCFrame(Positions[3])
end
if PositionValue == 4 then
AI:SetPrimaryPartCFrame(Positions[4])
end
if PositionValue == 5 then
AI:SetPrimaryPartCFrame(Positions[6])
end
if PositionValue == 6 then
AI:SetPrimaryPartCFrame(Positions[6])
end
if PositionValue == 7 then
AI:SetPrimaryPartCFrame(Positions[7])
end
if PositionValue == 8 then
AI:SetPrimaryPartCFrame(Positions[8])
end
if PositionValue == 9 then
AI:SetPrimaryPartCFrame(Positions[9])
elseif Door.Value == true then
wait(3)
PositionValue = 1
elseif Door.Value == false then
if PositionValue == 10 and Door.Value == false then
local char = game.Players.LocalPlayer.Character
char:FindFirstChild("Humanoid").Health = 0
end
end
until PositionValue == 10