Hi there!
I’m trying to make a door with a rotating handle using TweenService. My problem is that the hinge for the handle has to be anchored to turn, however to move with the door the hinge for the handle has to be welded to the door or the doorhinge.
My question is: is there any way to make this work? Can I somehow make the handle turn while attached to the door so it turns with the door?
Here’s the code I have so far (with all the code to make sounds + the door play cut out as those work perfectly)
local TweenService = game:GetService("TweenService")
local prompt = script.Parent.Door.ProximityPrompt
local handlehinge = script.Parent.HandleHinge
local goalOpenHandle = {}
goalOpenHandle.CFrame = handlehinge.CFrame * CFrame.Angles (0, 0, math.rad(-45))
local goalCloseHandle = {}
goalCloseHandle.CFrame = handlehinge.CFrame * CFrame.Angles (0, 0, 0)
local tweenInfoHandle = TweenInfo.new(0.25)
local tweenOpenHandle = TweenService:Create(handlehinge, tweenInfoHandle, goalOpenHandle)
local tweenCloseHandle = TweenService:Create(handlehinge, tweenInfoHandle, goalCloseHandle)
prompt.Triggered:Connect(function()
if prompt.ActionText == "Close" then
wait (1)
tweenOpenHandle:Play()
wait (0.25)
tweenCloseHandle:Play()
else
tweenOpenHandle:Play()
wait (0.25)
tweenCloseHandle:Play()
end
end)
Also, here’s the exploded weld setup for the door in case I need to edit any welds to make this work