It’s my first time using TweenService for parts, when it tweens to the grey part (as seen below) the red part goes down in height, until essentially the grey part is in the middle of it.
This is my script:
local TweenService = game:GetService("TweenService")
local part = script.Parent.Parent
local B = game.Workspace.Partb
local C = game.Workspace.Partc
local TweenInformation = TweenInfo.new(
5, --length
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
0,
false
)
local partPropertiesOpened = {
CFrame = B.CFrame
}
local partPropertiesClosed = {
CFrame = C.CFrame
}
local enabled = false
function TweenDoor()
if enabled == false then
enabled = true
local Tween = TweenService:Create(part,TweenInformation,partPropertiesOpened)
Tween:Play()
elseif enabled == true then
enabled = false
local CTween = TweenService:Create(part,TweenInformation,partPropertiesClosed)
CTween:Play()
end
end
part.ClickDetector.MouseClick:Connect(TweenDoor)
Once again, i’m not familiar with Tweening parts so any help is apperciated!