How do i make this CFrame.lookat() Code line have a position exception?

so im making a tower defense zombie game, and i want it so it turns at the node, not stare at node with its whole body. how do i fix this?

script.Parent.HumanoidRootPart.CFrame = CFrame.lookAt(script.Parent.HumanoidRootPart.Position, node.Position)

More information and a more detailed description would be helpful but I think I understand

script.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent.HumanoidRootPart.Position, Vector3.new(node.Position.X, script.Parent.HumanoidRootPart.Position.Y, node.Position.Z))

This will make it so the tower or whatever is looking at the node will turn towards the node but not look directly at it. You can have a position exception by just making a vector3 with x and z position of the node and the y position of the humanoidrootpart.

1 Like

i want it so it doesn’t stare at the node, only turn at the node.

Yep, that code above should do exactly that.

Nope, tried it. it kept staring down the nodes.

I need more context, meaning more code. The code above does exactly what you say, by making the humanoidrootpart only look at the node on the x and z positions, while still looking at its y position.

Well the context is that, every node it goes, it makes a new Torso.CFrame the codeline was suppose to only turn to node, so it doesn’t look weird when walking in turns.

If you’re wanting a smooth transition between turns look at tweening

And tween the cframe to to face the node.