Hi! I am trying to create a tool that has parts on it that I want to rotate whenever I click.
I have tried, but instead it ends up rotating my entire character. Been stuck on this for 2 hours so anything will help!
Code:
local leftSwitches = items.leftSwitches:GetChildren()
local rightSwitches = items.rightSwitches:GetChildren()
--
if not clicked then
for i, v in pairs(leftSwitches) do
local cf = CFrame.Angles(0, 0, math.rad(45))
v.CFrame = v.CFrame:ToObjectSpace(cf)
end
end
Because you are rotating unanchored Parts with a CFrame. It’ll try to rotate the whole assembly.
Try rotating the C0 or C1 of the welds that hold the Parts on.