Soo you know in ui how you can set an anchor point and if you resize it only goes like one direction. Im trying to get that with a part
How it is rn:
How i want it to:
Soo you know in ui how you can set an anchor point and if you resize it only goes like one direction. Im trying to get that with a part
How it is rn:
I don’t quite understand what you are asking. You did it in your second video just fine. Are you pressing control while scaling a part?
I ment for code. When in code it behaves like how it is rn
I dont know how to explain to be honest.
local toChange = Vector3.new(0, 5, 0)
part.Size += toChange
part.Position += toChange/2
Change the position with an offset alongside the size.
--!strict
--// Services
local ts = game:GetService("TweenService")
--// Other Variables
local part = script.Parent
local tweenInfo = TweenInfo.new(
0.5,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.InOut
)
--// Main Code
local function tweenSizeOffset(newSize: Vector3)
-- local offsetCorner = - (part.Size - newSize) / 2
local offsetSide = Vector3.new(
part.Size.X - newSize.X,
0,
part.Size.Z - newSize.Z
) / 2
local newTween = ts:Create(
part,
tweenInfo,
{
Size = newSize,
Position = part.Position + offsetSide
}
)
newTween:Play()
end
offset.rbxl (45.3 KB)
What if the part is already moving