#Trashcan's door pivot
1 messages · Page 1 of 1 (latest)
@arctic zenith what u tryna pivot?
The opening part
It should open like this
where code
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
because
you tween it from the middle
and didnt do any work whatsoever to lock the part to that segment of the trash can
Can you help?
no
rotate it from a different axis
Change the parts pivot
U can do it in studio in the model tab
Why ru using cframe twin
CFrame property of a part is unrelated to a pivot
You should use :PivotTo(cf) instead
okay, thanks!
PivotTo just teleports it there, he's trying to use tweenserv
And you can still tween it too