Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to rotate part of a tool without breaking it?

Asked by 4 years ago
Edited 4 years ago

Hello guys, I am trying to make a Minigun tool, and I want to have its Barrel Spin while it is being fired. However, using CFrame to spin it breaks the tool and either removes the weld, causing it to fall off, or spins the entire tool. Is there any way I could rotate just the Barrel, while also keeping it with the rest of the tool?

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Method 1:

Use a WeldConstraint https://developer.roblox.com/en-us/api-reference/class/WeldConstraint Using a WeldConstraint will keep the object welded even if u change the CFrame. You just have to define Part0 and Part1 of the WeldConstraint.

Method 2:

Directly manipulate the CFrame of the weld to keep it attached.

Weld.C0 = Weld.C0 * CFrame.Angles(0, 0, math.rad(45))
0
Thank you, I will try these as soon as I can virushunter9 943 — 4y
Ad

Answer this question