Found a strange something in part orientation

Hi! i have a trouble…
When i try to change part orientation, his Y position makes higher, idk whats wrong but idk how to fix that too.

local TweenService = game:GetService("TweenService")
local function TweenInformation(timing, Style, Direction)
	local CurrentInformation =, Enum.EasingStyle[Style], Enum.EasingDirection[Direction], 0, false, 0)
	return CurrentInformation
		local petpart = workspace:FindFirstChild("petpart")
while true do
			if (character.HumanoidRootPart.Position-petpart.Position).Magnitude >= 10 then
				local zcoo = character.HumanoidRootPart.Position.Z - petpart.Position.Z
				local xcoo = character.HumanoidRootPart.Position.X - petpart.Position.X
				if zcoo > 1.5 then zcoo = 1.5 elseif zcoo < -1.5 then zcoo = -1.5 end
				if xcoo > 1.5 then xcoo = 1.5 elseif xcoo < -1.5 then xcoo = -1.5 end
				local start =*2,17.5,zcoo*2)
				local lookAt = (start *,-5,0)).p
				local ray =, (lookAt-start.p).Unit * 100)
				local part, position, normal = workspace:FindPartOnRayWithIgnoreList(ray, {character, petpart, petpart})
				TweenService:Create(petpart, TweenInformation(0.1, "Sine", "Out"), { Position =, petpart.Position.Y+petpart.Size.Y*1.35, petpart.Position.Z+zcoo)}):Play()
				TweenService:Create(petpart, TweenInformation(0.1, "Sine", "Out"),{  Position =, position.Y+petpart.Size.Y/2, petpart.Position.Z+zcoo), Orientation = part.Orientation}):Play()
1 Like

hmm, maybe if you’re in studio and the block is in “anchored” it wouldn’t move(sometimes)
basically when im in studio I “anchored” the block and it moves very differently than what I need it to move. Maybe try un-achoring it but keep it grouped to see if the position of it changes, then “anchored” it back. (50/50 chance it would work)

that’s not work (( i will try more

1 Like

ok, good luck with that situation then✔


BasePart.Position and BasePart.Orientation are properties you should only read from, never set (except in very weird specific occasions but i’ve never had any in over 4 years)

You should use BasePart.CFrame instead. It basically serves as both position and orientation.

Here’s a basic CFrame constructor: * CFrame.Angles(0,0,0)
Here’s the same constructor except with specific position and orientation:,5,2) * CFrame.Angles(math.rad(90),math.rad(5),math.rad(10))

The first numbers in “” is the vector3 position, so basically same as the BasePart.Position you’d want to set, and “CFrame.Angles()” is the orientation, HOWEVER - you have to convert each degree number with math.rad(). So for example, instead of typing CFrame.Angles(90,0,0) you type in CFrame.Angles(math.rad(90),0,0) to rotate it by 90 degrees on the X axis

1 Like

how can i get orientation from CFrame? i tried …CFrame[numberofpos], and that not work

local X,Y,Z = CFrame:ToOrientation()

or alternatively you can use
local X,Y,Z = CFrame:ToEulerAnglesYXZ()
(if i recall correctly for some reason you have to use ToEulerAnglesYXZ instead of ToEulerAnglesXYZ, but if it’s wrong then use ToEulerAnglesXYZ, but ToOrientation always does the job so just use it)

1 Like