I am making a randomly generated obby. I am using :SetPrimaryPartCFrame(), however, it seems to not correctly update the orientation of the model. I am doing:

local function UpdatePosRot(template, pos)
	local LV = template.Hitbox.CFrame.LookVector
	print(LV)
	
	local newPos = pos + Vector3.new(LV.X * (template.Hitbox.Size.X) + padding, (template.Hitbox.Size.Y / 2), LV.Z * (template.Hitbox.Size.Z) + padding)
	local newRot = LV
	
	return newPos, newRot
end

position, rotation = UpdatePosRot(template, position)
stage:SetPrimaryPartCFrame(CFrame.new(position, rotation))

print(rotation)
print(stage.PrimaryPart.Orientation)

However, the two prints return different values. Rotation: -1, 0, -0 PrimaryPart Orientation: -12.7299995, -90.9700012, 0

How do I make them the same??

1 comment

0

I think getting the orientation of the model before the setprimary thingy and then setting the orientation to that previous orientation, hope you get the idea lol.