RigidConstraint is broken and makes the part not stick with the mesh When Changing a bone world rotation

RigidConstraint does not make a part follow the rig bone(Hand) when i change the world rotation of the bone.

here is a video of the issue: robloxapp-20250106-1656293
I have tried the method mentioned in How to use Rigid Constraints to add Accessories to Skinned Meshes

And i also tried another way to connect with 2 attachments, but nothing works.

the code is fairly simple and it works on server script

local lower = script.Parent.AnimationController.Animator:LoadAnimation(script.Parent.walk)
local upper = script.Parent.AnimationController.Animator:LoadAnimation(script.Parent.aim)
wait(3)
lower:Play()
upper:Play()
print(2)
while task.wait() do
	script.Parent.RootPart["mixamorig:Hips"]["mixamorig:Spine"].WorldOrientation = Vector3.new(0,0,0)
end

brokenAnimations.rbxl (791.3 KB)

Expected behavior

I expect the item(gun) to follow the hand precisly the same it does as without setting world orientation of the bone

Can anyone explain why does it work like that? i need help this issue has been for long and i dont know what to do

Hi, thanks for posting!

There’s a subtle issue with how you are updating the orientation of mixamorig.Spine. By default, scripts resume execution just after we perform simulation. So in your original code, the orientation update occurs just after we simulate. Instead, you’ll want this update to occur just before the animations are updated. The fix is simple, just bind your orientation update to PreAnimation:

local RunService = game:GetService("RunService")
RunService.PreAnimation:Connect(function(deltaTime)
	script.Parent.RootPart["mixamorig:Hips"]["mixamorig:Spine"].WorldOrientation = Vector3.new(0,0,0)
end)

See here for a detailed description of the order in which scripts are evaluated in the engine.

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