This uses CFrame.lookAt as it is newer. However, it is quite long without variables, so here’s how you would use them:
local char = script.Parent
local rootPart = char.HumanoidRootPart
... (your other code)
local tHead = t.Head
rootPart.CFrame = CFrame.lookAt(rootPart.Position, Vector3.new(tHead.Position.X, rootPart.Position.Y, tHead.Position.Z))
What this does is it does the same thing as the original script except it always uses the dummy’s Y position to look at the player. (If you do need specifically the X axis, swap it to Vector3.new(rootPart.Position.X, tHead.Position.Y, tHead.Position.Z))