Need Help Solving Swinging Tool Issue with Hinges

I’m not sure if a script is needed or some setting enabled in properties
I believe this is happening because there’s two parts, the Handle of the Tool, and the part that is only connected through Hinges, the bottom isn’t welded to the handle (because if it was it wouldn’t swing)
Video of Issue:


Setup:

Issue is the Hinges used for the Tool. The Part that is not Welded to the Handle but instead Attached to the Hinges on the Handle, does not keep its position with the Handle when unequipped, instead the position is locked to where it was, and then when reequipped quickly moves back to the Hinges, causing it to glide across

If the solution is a script, I’d appreciate help with that script as well as I don’t know how to program

1 Like

Have you tried setting the cframe to the expected handle pos when equipping the tool?

1 Like

When you unequip the tool, the location of where it was stays in that position, so when you reequip it, it quickly moves from that position into the players hand instead of being locked to the players’ position

Here’s another Video showing the issue

Kind of expected since unequipped Tools are not descendants of a physical space. @Kagries solution works. Here is my very professionally made lantern example:

Lantern.rbxm (13.6 KB)

--!strict

local relativeLanternOffset: CFrame = script.Parent.Lantern.CFrame:ToObjectSpace(script.Parent.Handle.CFrame)

script.Parent.Equipped:Connect(function(): ()
	script.Parent.Lantern.CFrame = relativeLanternOffset:ToObjectSpace(script.Parent.Handle.CFrame)
end)

It kind of twitches a little whenever you equip it, probably due to HingeConstraint recalculations (both parts moving towards each other), but I alleviated a little it by adding a tiny offset to the relative offset forward with CFrame.new(0, 0, -3) to prevent the character from getting “pulled” backwards. There’s probably a better way to do this, but even without it it’s good enough.

1 Like

Oh woah thanks I’ll try that, I actually made a solution of my own, it’s probably more jerry-rigged and a ridiculous solution but I thought to make a script that disables and enables the weld that attaches the two parts, and it surprisingly worked, heres the script that I used “Copilot” to make

Lantern.rbxm (8.1 KB)

Yours has a nicer sway, Thanks (^:

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