Sword that uses BodyPosition and BodyGyro flipping out when touched

As you can see in the gif, when a player comes into contact with another players sword, it flips out.

https://gyazo.com/7500d4487a482215b176e40a1a25fca0

The sword & purple mark are both set to CanCollide = false and I’ve even created a CollisionGroup for the players so they can’t collide.

I update the cframe of the BodyPosition and BodyGyro locally using RenderStepped

game:GetService("RunService").RenderStepped:connect(function()
    if character.Sword:FindFirstChild("BodyPosition") and 
character.Sword:FindFirstChild("BodyGyro") then
	    character.Sword.BodyPosition.Position = character.Anchor.Position
	    character.Sword.BodyGyro.CFrame = character.UpperTorso.CFrame * 
CFrame.Angles(0,math.rad(180), math.rad(155))
    end
end)

I can’t seem to find out the reason for it flipping out like this seeing as the player cannot interrupt the sword, so it should always reach it’s destination. Is there a solution?

I’m wondering if it’s to do with me doing setting the CFrame’s locally.

That is certainly possible.

Have you tried manually giving the player who is setting the CFrame the physics ownership? That could be another potential explanation for this.

I didn’t think about that ( never done that before ). I’ll go learn how to do that now then come back!

Here’s a link!

I love you, that fixed it! Thank you!

1 Like