#Trashcan's door pivot

1 messages · Page 1 of 1 (latest)

arctic zenith
#

Script is working, but the pivot is not.

soft urchin
#

@arctic zenith what u tryna pivot?

arctic zenith
#

It should open like this

lucid knoll
#

where code

arctic zenith
#
local clickDetector = door:FindFirstChild("ClickDetector")

local TweenService = game:GetService("TweenService")

local openSound = door:FindFirstChild("OpenSound")
local closeSound = door:FindFirstChild("CloseSound")

local closedCFrame = door.CFrame
local openCFrame = closedCFrame * CFrame.Angles(math.rad(-69.64), 0, 0)

local isOpen = false
local debounce = false

-- Tween settings
local openTweenInfo = TweenInfo.new(
    1,
    Enum.EasingStyle.Quad,
    Enum.EasingDirection.Out
)

local closeTweenInfo = TweenInfo.new(
    1.4,
    Enum.EasingStyle.Quart,
    Enum.EasingDirection.In
)

local openTween = TweenService:Create(door, openTweenInfo, {CFrame = openCFrame})
local closeTween = TweenService:Create(door, closeTweenInfo, {CFrame = closedCFrame})

clickDetector.MouseClick:Connect(function()
    if debounce then return end
    debounce = true

    if not isOpen then
        if openSound then openSound:Play() end
        openTween:Play()
        openTween.Completed:Wait()
        isOpen = true
    else
        if closeSound then closeSound:Play() end
        closeTween:Play()
        closeTween.Completed:Wait()
        isOpen = false
    end

    debounce = false
end) ```
#

@lucid knoll

lucid knoll
#

because

#

you tween it from the middle

#

and didnt do any work whatsoever to lock the part to that segment of the trash can

lucid knoll
#

no

soft urchin
#

rotate it from a different axis

turbid sapphire
#

Change the parts pivot

#

U can do it in studio in the model tab

#

Why ru using cframe twin

ancient narwhal
arctic zenith
#

okay, thanks!

pearl vigil
ancient narwhal