Roblox Studio:门的铰链旋转而不是本身

我在Roblox Studio中尝试制作一个带有动画效果的开关门。脚本能够运行,但是它旋转的是铰链而不是门本身。请告诉我我做错了什么,该如何修复它?

local tween = game:GetService("TweenService")

local Center = script.Parent.Center
local Door = "Closed"

local CF = Instance.new("CFrameValue")
CF.Value = Center.CFrame
CF.Changed:Connect(function()
    Center.CFrame = CF.Value
end)

script.Parent.Door.ClickDetector.MouseClick:Connect(function()
    if Door == "closed" then
        tween:Create(CF, TweenInfo.new(1), {Value = Center .CFrame * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))}):play()
        Door = "open"
    else
    tween:Create(CF, TweenInfo.new(1), {Value = Center .CFrame * CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))}):play()
        Door = "closed"
    end
end)
点赞