I’ve been trying to make NPC obby completion functions, and I’ve come up with a sort of rough draft for a “wall-hugging” obby course, but I can’t seem to get the rotation to change on the humanoid, no matter what I change the rotation to. I will leave the entire script and a place file for all of this below. Any ideas for why this npc will not actually rotate to the requested rotation?
Script
--Services
--Other
local obbyModel = game.Workspace.ObbyTest
local npcClone = game.ReplicatedStorage:WaitForChild("Dummy"):Clone()
npcClone.HumanoidRootPart.Position = obbyModel.StartPart.Position + Vector3.new(0,4,0)
npcClone.Parent = game.Workspace
npcClone.Humanoid:MoveTo(obbyModel.Path1.Position)
local jumped = false
local endTouched
local loopTimes = 0
local function testJump(humanoid)
humanoid.Jump = true
jumped = true
end
obbyModel.JumpPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
testJump(hit.Parent.Humanoid)
end
end)
repeat wait() until jumped == true
npcClone.Humanoid:MoveTo(obbyModel.Path2.Position)
--Wallhug
local animator = Instance.new("Animator")
animator.Name = "Animator"
animator.Parent = npcClone.Humanoid
local animationInstance = Instance.new("Animation")
animationInstance.AnimationId = "rbxassetid://7148106034"
animationInstance.Parent = npcClone.Humanoid
while true do
npcClone.HumanoidRootPart.Orientation = Vector3.new(obbyModel.BackWallTop.Orientation.X ,obbyModel.BackWallTop.Orientation.Y,obbyModel.BackWallTop.Orientation.Z )
--local loadedAnimation = animator:LoadAnimation(animationInstance)
--loadedAnimation:Play()
--loadedAnimation.Stopped:Connect(function()
-- npcClone.HumanoidRootPart.CFrame = npcClone.Torso.CFrame
--end)
--loadedAnimation.Stopped:Wait()
wait()
--npcClone.Humanoid:MoveTo(obbyModel.PathfindingGoal.Position)
end
wait(5)
wait(1)
File (ServerScriptService)
Baseplate.rbxl (30.5 KB)