Help with making a rotating doorknob

(Ok this might be slightly more of a physics thing but it’s still mostly scripting related)

I have a fairly basic door, working by tweening a root part which the main door is welded to.
However, my doorknobs being unanochred means I am incapable of tweening them.
Normal welds don’t seem to be repositionable and break the knob mesh’s location, weldconstraints don’t seem capable of being rotated, and angularvelocity bodymovers and motor6ds seem to have no effect.

It could be a problem with the angularvelocity/motor6ds that I was unaware of, but I can’t seem to find any good resources or posts on this issue, and fiddling with the properties doesn’t seem to do anything either.

Try changing the C0 or C1 (I forget) of the doorknob when using Motor6Ds, constantly.

Is it possible you could elaborate on this a bit more? I’m kinda confused on what you mean (mainly about what do I change on the C0)

Check the page for Motor6Ds then check properties.

You could use @CipherFunctions’s solution with a Motor6D (which i find to be a much better solution in this case), or you can also try using the deprecated Weld.

Weld has a C0 and C1 property.

You will have to set the C0 and C1 to the desired location, but then you will be able to tween a rotation:

local part0 = workspace.Part0
local part1 = workspace.Part1
local newcframe = part1.CFrame * CFrame.Angles(0, math.rad(90), 0)
local cframes = {part0.CFrame, part1.CFrame}

local weld = Instance.new("Weld", part0)
weld.Part0 = part0
weld.Part1 = part1
weld.C0 = cframes[1]
weld.C1 = cframes[2]

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)

local tween = ts:Create(part1, ti, {["CFrame"] = newcframe})
tween:Play()

Again, I still think that @CipherFunctions’s solution is better in multiple ways. But, you can try this alternative if you wish.

Got a bit stuck on this at first but turns out it was just me being dumb.
This in fact works, thank you.

I have some other issues but those will be for another thread if I can’t figure them out.

1 Like