AlignOrientation not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m using AlignOrientation, with 0Attachment Type so that it’ll face an object it is walking to throughout the pathfinding waypoints.

  2. What is the issue? Include screenshots / videos if possible!
    However, it does not work as the pet faces the same direction regardless.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried to use TwoAttachment which didn’t work. I also used CFrame.Lookat but it was not smooth, I was hoping to be able to use AlignOrientation as it’d be more smooth.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Pet doesn’t face correct direction of goal.


This is the hierachy for the pet.
image

if Path.Status == Enum.PathStatus.Success then
		local Waypoints = Path:GetWaypoints()
		for i, Waypoint in Waypoints do
			Align.Attachment0.WorldCFrame = CFrame.new(HumanoidRootPart.Position,Goal.Position) --This is the issue part; I'm not sure what I'm doing wrong for it.
			if Waypoint.Action == Enum.HumanoidStateType.Jumping then
				script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			end
			
			if Waypoint.Position == Goal.Position then
				Humanoid:MoveTo(Goal.Position)
				Humanoid.MoveToFinished:Wait()
				Pet.PrimaryPart.CFrame = PetBed.CFrame:ToWorldSpace(CFrame.new(0,2.5,0))
				Pet.PrimaryPart.Anchored = true
				--Sleeping stuff
				Pet.Head.ParticleEmitter.Enabled = true
				Pet.Head.FacePlaceHolder.Awake.Transparency = 1
				Pet.Head.FacePlaceHolder.Sleeping.Transparency = 0
				
				task.wait(15)
				
				Pet.Head.ParticleEmitter.Enabled = false
				Pet.Head.FacePlaceHolder.Awake.Transparency = 0
				Pet.Head.FacePlaceHolder.Sleeping.Transparency = 1
				
				--Restoring energy
				Energy = PetStats.energy
				Pet.PrimaryPart.Anchored = false
				continue
			else
				Humanoid:MoveTo(Waypoint.Position)
			end
		end
	end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Fixed. Was a property problem, not a code problem.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.