Trouble with rotating a Character towards another one

So I got a punch script and everything is working fine like animations, damage, particle emission, stuff like that but I want to make the person getting attacked to look at the attacker and then get sent back a bit, I know how to do the send back thing but I’m having trouble making the person look at the attacker

Right now I have code setup that brings up no problems but still doesn’t rotate the model of the person getting attacked. I read on other forums that to move models you should use :SetPrimaryPartCFrame so that is what I’m using right now.

I tried fixing it myself which is what I have done for everything so far and its been going well but right now every time I try to fix this it ends up with an error code

--Problem
local Attacker = character:GetPivot()
local EnemyCframe = hit.Parent:GetPrimaryPartCFrame()
hit.Parent:SetPrimaryPartCFrame(EnemyCframe * CFrame.lookAt(EnemyCframe.Position, Attacker.Position))
local Attacker = character:GetPivot()
hit.Parent:PivotTo(CFrame.lookAt(hit.Parent:GetPivot().Position, Vector3.new(Attacker.Position.X, hit.Parent:GetPivot().Position.Y, Attacker.Position.Z)))

Thank you so much, that fixed literally everything and can help me do some other ideas I had in mind

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