Repositionpart relative to orientation

does this help at all?

HitPart.Position= (HitPart.CFrame * CFrame.new(relativeX, relativeY, relativeZ)).p

then save the cframe of the liquid in relation to the sauce pan

:confused:

I made a place repro
CframeAnnoyMe.rbxl (32.4 KB)

Ok ill fix it in studio and upload it

So you just want it to resize upwards?

https://gyazo.com/13020be4f159f112dd3814b9c1eb7410

Expected behaviour, only it doesn’t work at rotations.

Is this how it should look?

I made it semi transparent so u can see inside

here u go

I reformatted things a little to be more intuitive

local Pan = script.Parent
local Liquid = Pan.Liquid
local WeldConstraint = script.Parent.WeldConstraint

local xGoal = 1.6


for i=1,200 do wait()
	WeldConstraint.Enabled = false
	local xSize = xGoal*(i/200)
	Liquid.Size = Vector3.new(xSize,Liquid.Size.Y,Liquid.Size.Z)
	Liquid.CFrame = Pan.CFrame*CFrame.new(Pan.Size.X/2 - Liquid.Size.X/2,0,0)
	WeldConstraint.Enabled = true
end

CframeAnnoyMe.rbxl (32.6 KB)

image

1 Like

Here is my solution i reformatted the for loop:

local Part = game.Workspace.SaucePan.Liquid
local SaucePan = game.Workspace.SaucePan
local Weld = SaucePan.WeldConstraint

SaucePan.Anchored = true
Part.Anchored = true
Weld.Enabled = false

for i = Part.Size.X, (SaucePan.Size.X - 0.1)  do
	Part.Size = Part.Size + Vector3.new(i, 0, 0) 
	Part.CFrame = Part.CFrame * CFrame.new(-(i/2),0,0)	
end

Weld.Enabled = true
SaucePan.Anchored = false
Part.Anchored = false

CframeAnnoyMe.rbxl (32.5 KB)