*Correction: Part objects use Vector3's for Size, Position, and Orientation; while UI objects use UDim2's.
To properly tween BaseParts (any 3d geometry like Unions, Parts, and MeshParts), use the TweenService:Create function.
=============================== How to ===============================
You need any tweenable object, a TweenInfo, and a table with a list of property names and their goal values.
For example:
Making a simple TweenInfo
local Simple_TweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
Making a simple table with property names
local Simple_Table = {
Position = Vector3.new(2, 10, 2),
Size = Vector3.new(5, 5, 5)
}
Making a Tween
local Tween = TweenService.new(TargetPart, Simple_TweenInfo, Simple_Table)
Playing a Tween
Tween:Play()
Pausing/Stopping a Tween
Tween:Pause()
Tween:Cancel()
=============================== Links ===============================
For more information about Tweens, TweenService, and TweenInfo, here are some links:
TweenService: https://developer.roblox.com/en-us/api-reference/class/TweenService
Tween: https://developer.roblox.com/en-us/api-reference/class/Tween
TweenInfo: https://developer.roblox.com/en-us/api-reference/datatype/TweenInfo
=============================== Final ===============================
So, to finish the answer, here is how you can use it:
local click = script.Parent.Click
local closed = true
local door = script.Parent.Parent.Parent.Parent.Door
local tService = game:GetService("TweenService")
local tInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tGoal = {Position = Vector3.new(83, 5, 56.5)}
local tween = tService.new(door, tInfo, tGoal)
click.MouseClick:Connect(function()
if closed == true then
script.Parent.BrickColor = BrickColor.new("Bright green")
tween:Play()
closed = false
else
if closed === false then
end
end
end)