Ive been trying to make a grab system using align orientation and position but there is 1 small issue ive been expriencing and that is when the enemy is in the air for example and not rotated the same rotation as the player it causes the player to rotate too
Code:
function module.Grab(Character,Enemy,Part0,Part1,C0,C1,Time)
local Attachment0 = Instance.new("Attachment",Part0)
local Attachment1 = Instance.new("Attachment",Part1)
Attachment0.CFrame = C0
Attachment1.CFrame = C1
Enemy.Humanoid.PlatformStand = true
local AlignOrientation = Instance.new('AlignOrientation')
AlignOrientation.Parent = Part1
AlignOrientation.ReactionTorqueEnabled = true
AlignOrientation.MaxTorque = math.huge
AlignOrientation.Responsiveness = 200
AlignOrientation.Mode = Enum.OrientationAlignmentMode.TwoAttachment
AlignOrientation.MaxAngularVelocity = math.huge
local AlignPosition = Instance.new('AlignPosition')
AlignPosition.Parent = Part1
AlignPosition.MaxForce = 99999
AlignPosition.ForceRelativeTo = Enum.ActuatorRelativeTo.Attachment0
AlignPosition.MaxAxesForce = Vector3.one * math.huge
AlignPosition.ApplyAtCenterOfMass = false
AlignPosition.ReactionForceEnabled = true
AlignPosition.Responsiveness = 200
AlignPosition.Mode = Enum.PositionAlignmentMode.TwoAttachment
AlignPosition.MaxVelocity = math.huge
AlignPosition.Attachment0 = Attachment1
AlignPosition.Attachment1 = Attachment0
AlignOrientation.Attachment1 = Attachment0
AlignOrientation.Attachment0 = Attachment1
task.delay(Time,function()
AlignPosition:Destroy()
AlignOrientation:Destroy()
Attachment0:Destroy()
Attachment1:Destroy()
end)
end
``` i tried disabling ReactionForce and ReactionTorque but it seems to have messed with it even more
Sorry, I didn’t notice that.
Did you make sure Attachment1 is set to the hand attachment? I can’t tell whether Attachment0 or Attachment1 (the variables) is the hand attachment.
Oh I see what you mean, I was thinking of grabbing objects instead of players.
If setting Attachment1 to RootAttachment doesn’t work, you could try setting the Density and Massless properties of all the grabbed character’s limbs to 0.001 and true respectively, and reset them to 0.7 and false after. (I’m not sure if Masless yields the same result as setting the density to 0.001, you would have to test that)
Alternatively, instead of using AlignOrientation and AlignPosition, you could use RunService.Heartbeat to constantly set the CFrame of the enemy to be in front of and facing the holder, then disconnect it after Time.
Try changing the AlignType in the AlignOrientation to PrimaryAxisLookAt, and set the Attachment1 or LookAtPosition property to where you want the grabbed character to face.
I tried this and it appears to be working as intended. Can you elaborate?
You can copy the properties I set on the AlignOrientation and see if that works.
The parts are being held up by BallSocketConstraints.
The orange frame is on the front of the held part.