Here is some footage:
The door behaves differently when I anchor or unanchor the handle.
local TweenService = game:GetService("TweenService")
local door = script.Parent.Door
local hinges = script.Parent.Hinges
local prompt = door.ProximityPrompt
local knob = {
script.Parent.Handle.HandleInvis;
script.Parent.Handle["Handle.000"];
script.Parent.Handle["Handle.001"];
}
local goalOpen = {
{CFrame = hinges.Hinge1.CFrame * CFrame.Angles(0, math.rad(90), 0)};
{CFrame = hinges.Hinge2.CFrame * CFrame.Angles(0, math.rad(90), 0)};
{CFrame = hinges.Hinge3.CFrame * CFrame.Angles(0, math.rad(90), 0)};
{CFrame = knob[1].CFrame * CFrame.Angles(0, 0, math.rad(30))};
}
local goalClose = {
{CFrame = hinges.Hinge1.CFrame * CFrame.Angles(0, math.rad(0), 0)};
{CFrame = hinges.Hinge2.CFrame * CFrame.Angles(0, math.rad(0), 0)};
{CFrame = hinges.Hinge3.CFrame * CFrame.Angles(0, math.rad(0), 0)};
{CFrame = knob[1].CFrame * CFrame.Angles(0, 0, math.rad(0))};
}
local tweenInfo = {
TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
);
TweenInfo.new(
0.3,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.InOut,
0,
true,
0
);
}
local tweenOpen = {
TweenService:Create(hinges.Hinge1, tweenInfo[1], goalOpen[1]);
TweenService:Create(hinges.Hinge2, tweenInfo[1], goalOpen[2]);
TweenService:Create(hinges.Hinge3, tweenInfo[1], goalOpen[3]);
TweenService:Create(knob[1], tweenInfo[2], goalOpen[4]);
TweenService:Create(knob[2], tweenInfo[2], goalOpen[4]);
}
local tweenClose = {
TweenService:Create(hinges.Hinge1, tweenInfo[1], goalClose[1]);
TweenService:Create(hinges.Hinge2, tweenInfo[1], goalClose[2]);
TweenService:Create(hinges.Hinge3, tweenInfo[1], goalClose[3]);
}
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://15524073135"
Sound.EmitterSize = 5
Sound.Parent = door
prompt.Triggered:Connect(function()
if prompt.ActionText == "Close" then
tweenClose[1]:Play()
tweenClose[2]:Play()
tweenClose[3]:Play()
tweenOpen[4]:Play()
tweenOpen[5]:Play()
prompt.Enabled = false
prompt.ActionText = "Open"
Sound:Play()
tweenClose[3].Completed:Wait()
prompt.Enabled = true
elseif prompt.ActionText == "Open" then
tweenOpen[1]:Play()
tweenOpen[2]:Play()
tweenOpen[3]:Play()
tweenOpen[4]:Play()
tweenOpen[5]:Play()
prompt.Enabled = false
prompt.ActionText = "Close"
Sound:Play()
tweenOpen[3].Completed:Wait()
prompt.Enabled = true
else
error()
end
end)