I’m making a cooking system and I need ingredients to be put ontop of other ingredients. In other words, I need to put a part ontop of another part. I’m wondering, am I doing it correctly? When I try it like this:
local YPos = highestpart.CFrame.Y+(highestpart.Size.Y)/2
part.CFrame = CFrame.new(highestpart.CFrame.X,YPos,highestpart.CFrame.Z)
It puts the part a few studs over the highestpart like this:
If anyone knows how I can fix this please help!
local Bread = -- Path to part; lowest part
local Meat = -- Path to part; highest part
local AddHeight = Bread.Size.X/2 + Meat.Size.X/2
Meat.CFrame = Bread.CFrame * CFrame.new(AddHeight, 0, 0)
-- We use the X-axis of the bread as I suppose the bread is rotated.
I suggest messing around with the CFrame.new(), until the part is positioned correctly; This can be done by putting a minus before the value AddHeight, moving the value 1 comma, changing the X into a Y or Z.