Model orientation query

I am trying to get the orientation of a model (shaped like a bot)
If I use math.rad(45) in the Y part of a CFrame and apply it I dont get the Bot orientated towards the right as I expected.
From experimentation I have it working using the Z part but that does not make sense to me.
I have attached some pics and the rbxl file.
Pic1 shows the set of Bots arranged as I want using the Z option.
Pic2a show the set with the right hand Bot not being correctly orientated.
Pic2b show a close up so the twist can be seen.
Pic3 shows the code snippet where I have tried the two options.

Would someone please help me understand why using the Y part of a CFrame does not turn the model 45 degrees to the right around the vertical axis.





ReproModelAndBeam.rbxl (18.3 KB)

1 Like

I cannot access your place right now, but try printing the primary part CFrame’s look vector. It looks like you missorientated it to point upwards.

Thanks for the hint about my post. I edited it.

I use an orientation to get each Bot facing the same way as the Red bot
CFrame.Angles(-math.rad(90),0,0)
I did try using
CFrame.Angles(-math.rad(90),math.rad(45),0) to get Bot facing 45 degrees to the right but failed so
decided to try using two orientations.

Prints of lookvectors before and after are
For Pic1
Using second orientation of CFrame.Angles(0,math.rad(45),0)

BotLookVectorB4= -0, -0, -1
BotLookVectorAfterSetPrimaryPartCFrame= -0, -0, -1
BotLookVectorAftr= -0, -1, 4.37113883e-08
Bot2LookVectorB4= -0, -0, -1
Bot2LookVectorAfterSetPrimaryPartCFrame= -0, -0, -1
BotLookVectorAfterFirstOrientation= -0, -1, 4.37113883e-08
Bot2LookVectorAfterSecondOrientation= -0.707106769, -0.707106769, 3.09086197e-08

For Pic2
Using second orientation of CFrame.Angles(0,0,math.rad(45))

BotLookVectorB4= -0, -0, -1
BotLookVectorAfterSetPrimaryPartCFrame= 5.76883394e-05, -2.32210717e-09, -1
BotLookVectorAftr= 8.85374902e-08, -1, 4.6038604e-08
Bot2LookVectorB4= -0, -0, -1
Bot2LookVectorAfterSetPrimaryPartCFrame= 5.76883394e-05, -2.32210717e-09, -1
Bot2LookVectorAfterFirstOrientation= 8.85374902e-08, -1, 4.6038604e-08
Bot2LookVectorAfterSecondOrientation= 8.85367939e-08, -1, 4.60379113e-08

I am doing two orientation processes because I tried using one

So wait. You want to rotate the bot by 45° on the vertical (Y) axis, yet your 2nd pic and its output show that its being rotated by 45° along the front (Z) axis.

CFrame.Angles(0,0,math.rad(45)) - This is the Z axis.

Also, what exactly is the difference between BotLookVectorAfterSetPrimaryPartCFrame and BotLookVectorAftr?

I needed to rotate each blue Bot so it faced forwards and for the second so it faced right by 45 degrees.
Here is the code

print("Hello world!")
local Players = game:GetService("Players")
local LP = Players.LocalPlayer
local PlrGui = LP:WaitForChild("PlayerGui")
local PN = LP.Name 
print ("PlayerName="..PN)
local AP = workspace:WaitForChild(PN)
local HRP = AP:WaitForChild("HumanoidRootPart")
local Controller = script.Parent
local color1 = Color3.fromRGB(251,255,183)
local color2 = Color3.fromRGB(255,255,15)
local colorSeq = ColorSequence.new(color1,color2)
local parts = {}
local BeamOFF = NumberSequence.new({
	NumberSequenceKeypoint.new(0,1),
	NumberSequenceKeypoint.new(0.5,1),
	NumberSequenceKeypoint.new(1,1),})

local function scanWeld(parent,Bot)
	for _,v in pairs(parent:GetChildren()) do
		if (v:IsA("BasePart")) then
			if v.Name ~= "MainPart" then
				local w = Instance.new("WeldConstraint")
				w.Name = ("WC_%s"):format(v.Name)
				w.Part0 = Bot.MainPart
				w.Part1 = v
				w.Parent = Bot.MainPart
				table.insert(parts,v)
				scanWeld(v)
				wait(0.05)
			end
		end
	end
end

Controller.Equipped:Connect(function()
	print("Equiping")
	local waits = 3
	local RS = game:GetService("ReplicatedStorage")
	local APLTCF = AP.LowerTorso.CFrame
	local Controller = AP:WaitForChild("Controller")
	local Handle = Controller:WaitForChild("Handle")
	print("Handle set Wait")
	wait(waits)
	local BotMaster = RS.BotMaster:Clone()
	BotMaster.Parent = Handle	
	local BotMasterOffset = Vector3.new(-0.5,0,-1.25)
	local BotMasterOrientation = CFrame.Angles(0,0,math.rad(90))
	local APLTCF = AP.LowerTorso.CFrame
	local BotMainPartCFrameAdjustment = APLTCF + APLTCF.lookVector + BotMasterOffset
	BotMaster:SetPrimaryPartCFrame(BotMainPartCFrameAdjustment)
	local orientBot = BotMaster:GetPrimaryPartCFrame() * BotMasterOrientation 
	BotMaster:SetPrimaryPartCFrame(orientBot)
	print("BotMasterLookVector=",BotMaster.MainPart.CFrame.LookVector)
	scanWeld(BotMaster, BotMaster)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w1 = Instance.new("WeldConstraint")
	w1.Part0 = Handle
	w1.Part1 = BotMaster.MainPart
	w1.Name = "WC_BotMaster"
	w1.Parent = Handle
	BotMaster.MainPart.Anchored = false
	print("BotMaster Anchoring Wait")
	wait(waits)
	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = AP.UpperTorso.BodyFrontAttachment
	beam.Width0 = 0.2
	beam.Attachment1 = BotMaster.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_BotMaster"
	beam.Parent = AP.UpperTorso
	print("BotMaster Beam Wait")
	wait(waits)
	AP.UpperTorso:WaitForChild("Beam_BotMaster").Transparency = BeamOFF
	
	local Bot = RS.Bot:Clone()
	wait(1)
	print("BotLookVectorB4=",Bot.MainPart.CFrame.LookVector)
	local BotMainPartCFrameAdjustment = CFrame.new(0,0,0)
	local BotOffset = Vector3.new(0,-0.25,-6)
	local OffsetDiff = APLTCF.LookVector + BotOffset
	BotMainPartCFrameAdjustment = APLTCF + APLTCF.LookVector + BotOffset
	Bot:SetPrimaryPartCFrame(BotMainPartCFrameAdjustment)
	print("BotLookVectorAfterSetPrimaryPartCFrame=",Bot.MainPart.CFrame.LookVector)
	local BotOrientation = CFrame.Angles(-math.rad(90),0,0)
	print("BotOrientationCFrame=",BotOrientation)
	local orientDigaBot = Bot:GetPrimaryPartCFrame() * BotOrientation
	print("orientDigBotCFrame=",orientDigaBot)
	Bot:SetPrimaryPartCFrame(orientDigaBot)
	Bot.Parent = BotMaster
	print("BotLookVectorAftr=",Bot.MainPart.CFrame.LookVector)
	print("Bot Parented Wait")
	wait(waits)
	scanWeld(Bot, Bot)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w2 = Instance.new("WeldConstraint")
	w2.Part0 = AP.LowerTorso
	w2.Part1 = Bot.MainPart
	w2.Name = "WC_Bot"
	w2.Parent = BotMaster
	Bot.MainPart.Anchored = false
	print("Bot Anchoring Wait")
	wait(waits)
	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = BotMaster.Screen.Attachment
	beam.Width0 = 0.2
	beam.Attachment1 = Bot.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_Bot"
	beam.Parent = BotMaster
	print("Bot Beam Wait")
	wait(waits)
	BotMaster:WaitForChild("Beam_Bot").Transparency = BeamOFF
	
	local Bot2 = RS.Bot:Clone()
	wait(1)
	print("Bot2LookVectorB4=",Bot2.MainPart.CFrame.LookVector)
	local Bot2MainPartCFrameAdjustment = CFrame.new(0,0,0)
	local Bot2Offset = Vector3.new(3.75,-0.25,-3.75)
	local OffsetDiff2 = APLTCF.LookVector + Bot2Offset
	Bot2MainPartCFrameAdjustment = APLTCF + APLTCF.LookVector + Bot2Offset
	Bot2:SetPrimaryPartCFrame(Bot2MainPartCFrameAdjustment)
	print("Bot2LookVectorAfterSetPrimaryPartCFrame=",Bot2.MainPart.CFrame.LookVector)
	local Bot2Orientation = CFrame.Angles(-math.rad(90),0,0)	-- same as bot1
--	local Bot2Orientation = CFrame.Angles(-math.rad(90),math.rad(45),0)	-- same as bot1 with right turn 45
	print("Bot2OrientationCFrame=",Bot2Orientation)
	local orientDigaBot2 = Bot2:GetPrimaryPartCFrame() * Bot2Orientation
	print("orientDigBot2CFrame=",orientDigaBot2)
	Bot2:SetPrimaryPartCFrame(orientDigaBot2)
	wait()
	print("BotLookVectorAfterFirstOrientation=",Bot2.MainPart.CFrame.LookVector)
	Bot2Orientation = CFrame.Angles(0,0,-math.rad(45))	--	right 45 using Z ??? Pic1
--	Bot2Orientation = CFrame.Angles(0,math.rad(45),0)	--	right 45 using Y ??? Pic2
	orientDigaBot2 = Bot2:GetPrimaryPartCFrame() * Bot2Orientation
	Bot2:SetPrimaryPartCFrame(orientDigaBot2)
	Bot2.Parent = BotMaster
	print("Bot2LookVectorAfterSecondOrientation=",Bot2.MainPart.CFrame.LookVector)
	print("Bot2 Parented Wait")
	wait(waits)
	scanWeld(Bot2, Bot2)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w3 = Instance.new("WeldConstraint")
	w3.Part0 = AP.LowerTorso
	w3.Part1 = Bot2.MainPart
	w3.Name = "WC_Bot2"
	w3.Parent = BotMaster
	Bot2.MainPart.Anchored = false
	print("Bot2 Anchoring Wait")
	wait(waits)
	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = BotMaster.Screen.Attachment
	beam.Width0 = 0.2
	beam.Attachment1 = Bot2.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_Bot2"
	beam.Parent = BotMaster
	print("Bot2 Beam Wait")
	wait(waits)
	BotMaster:WaitForChild("Beam_Bot2").Transparency = BeamOFF
	
	
	print("Equiped")
end)

Ok. So continuing with my experimentation I decide that as all the blue Bots need to be facing forwards I would move the model to workspace, use the Studio rotation tool and move it back to ReplicatedStorage and comment out the rotation code used to get both blue Bots facing forwards.

The orientation for the right hand turn now works but both blue Bots are facing upwards, not forward as expected.
I have attached two more pics. One showing the blue Bot model facing forward and the other the end of test run.


RobloxOrientationQuery_Pic5

Here is the adjusted code

print("Hello world!")
local Players = game:GetService("Players")
local LP = Players.LocalPlayer
local PlrGui = LP:WaitForChild("PlayerGui")
local PN = LP.Name 
print ("PlayerName="..PN)
local AP = workspace:WaitForChild(PN)
local HRP = AP:WaitForChild("HumanoidRootPart")
local Controller = script.Parent
local color1 = Color3.fromRGB(251,255,183)
local color2 = Color3.fromRGB(255,255,15)
local colorSeq = ColorSequence.new(color1,color2)
local parts = {}
local BeamOFF = NumberSequence.new({
	NumberSequenceKeypoint.new(0,1),
	NumberSequenceKeypoint.new(0.5,1),
	NumberSequenceKeypoint.new(1,1),})

local function scanWeld(parent,Bot)
	for _,v in pairs(parent:GetChildren()) do
		if (v:IsA("BasePart")) then
			if v.Name ~= "MainPart" then
				local w = Instance.new("WeldConstraint")
				w.Name = ("WC_%s"):format(v.Name)
				w.Part0 = Bot.MainPart
				w.Part1 = v
				w.Parent = Bot.MainPart
				table.insert(parts,v)
				scanWeld(v)
				wait(0.05)
			end
		end
	end
end

Controller.Equipped:Connect(function()
	print("Equiping")
	local waits = 3
	local RS = game:GetService("ReplicatedStorage")
	local APLTCF = AP.LowerTorso.CFrame
	local Controller = AP:WaitForChild("Controller")
	local Handle = Controller:WaitForChild("Handle")
	print("Handle set Wait")
	wait(waits)
	local BotMaster = RS.BotMaster:Clone()
	BotMaster.Parent = Handle	
	local BotMasterOffset = Vector3.new(-0.5,0,-1.25)
	local BotMasterOrientation = CFrame.Angles(0,0,math.rad(90))
	local APLTCF = AP.LowerTorso.CFrame
	local BotMainPartCFrameAdjustment = APLTCF + APLTCF.lookVector + BotMasterOffset
	BotMaster:SetPrimaryPartCFrame(BotMainPartCFrameAdjustment)
	local orientBot = BotMaster:GetPrimaryPartCFrame() * BotMasterOrientation 
	BotMaster:SetPrimaryPartCFrame(orientBot)
	print("BotMasterLookVector=",BotMaster.MainPart.CFrame.LookVector)
	scanWeld(BotMaster, BotMaster)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w1 = Instance.new("WeldConstraint")
	w1.Part0 = Handle
	w1.Part1 = BotMaster.MainPart
	w1.Name = "WC_BotMaster"
	w1.Parent = Handle
	BotMaster.MainPart.Anchored = false
	print("BotMaster Anchoring Wait")
	wait(waits)
	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = AP.UpperTorso.BodyFrontAttachment
	beam.Width0 = 0.2
	beam.Attachment1 = BotMaster.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_BotMaster"
	beam.Parent = AP.UpperTorso
	print("BotMaster Beam Wait")
	wait(waits)
	AP.UpperTorso:WaitForChild("Beam_BotMaster").Transparency = BeamOFF
	
	local Bot = RS.Bot:Clone()
	wait(1)
	print("BotLookVectorB4=",Bot.MainPart.CFrame.LookVector)
	local BotMainPartCFrameAdjustment = CFrame.new(0,0,0)
	local BotOffset = Vector3.new(0,-0.25,-6)
	local OffsetDiff = APLTCF.LookVector + BotOffset
	BotMainPartCFrameAdjustment = APLTCF + APLTCF.LookVector + BotOffset
	Bot:SetPrimaryPartCFrame(BotMainPartCFrameAdjustment)
	print("BotLookVectorAfterSetPrimaryPartCFrame=",Bot.MainPart.CFrame.LookVector)
--	local BotOrientation = CFrame.Angles(-math.rad(90),0,0)
--	print("BotOrientationCFrame=",BotOrientation)
--	local orientDigaBot = Bot:GetPrimaryPartCFrame() * BotOrientation
--	print("orientDigBotCFrame=",orientDigaBot)
--	Bot:SetPrimaryPartCFrame(orientDigaBot)
	Bot.Parent = BotMaster
	print("BotLookVectorAftr=",Bot.MainPart.CFrame.LookVector)
	print("Bot Parented Wait")
	wait(waits)
	scanWeld(Bot, Bot)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w2 = Instance.new("WeldConstraint")
	w2.Part0 = AP.LowerTorso
	w2.Part1 = Bot.MainPart
	w2.Name = "WC_Bot"
	w2.Parent = BotMaster
	Bot.MainPart.Anchored = false
	print("Bot Anchoring Wait")
	wait(waits)
	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = BotMaster.Screen.Attachment
	beam.Width0 = 0.2
	beam.Attachment1 = Bot.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_Bot"
	beam.Parent = BotMaster
	print("Bot Beam Wait")
	wait(waits)
	BotMaster:WaitForChild("Beam_Bot").Transparency = BeamOFF
	
	local Bot2 = RS.Bot:Clone()
	wait(1)
	print("Bot2LookVectorB4=",Bot2.MainPart.CFrame.LookVector)
	local Bot2MainPartCFrameAdjustment = CFrame.new(0,0,0)
	local Bot2Offset = Vector3.new(3.75,-0.25,-3.75)
	local OffsetDiff2 = APLTCF.LookVector + Bot2Offset
	Bot2MainPartCFrameAdjustment = APLTCF + APLTCF.LookVector + Bot2Offset
	Bot2:SetPrimaryPartCFrame(Bot2MainPartCFrameAdjustment)
	print("Bot2LookVectorAfterSetPrimaryPartCFrame=",Bot2.MainPart.CFrame.LookVector)
--	local Bot2Orientation1 = CFrame.Angles(-math.rad(90),0,0)	-- same as bot1
	local Bot2Orientation2 = CFrame.Angles(0,math.rad(45),0)	-- same as bot1 with right turn 45
--	print("Bot2OrientationCFrame1=",Bot2Orientation1)
	print("Bot2OrientationCFrame2=",Bot2Orientation2)
	local orientDigaBot2 = Bot2:GetPrimaryPartCFrame() * Bot2Orientation2 --* Bot2Orientation1
	print("orientDigBot2CFrame=",orientDigaBot2)
	Bot2:SetPrimaryPartCFrame(orientDigaBot2)
--	Bot2.Parent = BotMaster
--	print("Bot2LookVectorSameAsBot1?",Bot2.MainPart.CFrame.LookVector)
--	wait(waits)

--	local Bot2ApplyRotationCFrame = CFrame.Angles(0,0,-math.rad(45))	--	right 45 using Z ??? Pic1
--	local Bot2ApplyRotationCFrame = CFrame.Angles(0,math.rad(45),0)	--	right 45 using Y ??? Pic2
--	local Bot2CFrame = Bot2:GetPrimaryPartCFrame()
--	local Bot2PositionCFrame = CFrame.new(Bot2CFrame.p)
--	local Bot2RotationCFrame = Bot2CFrame - Bot2CFrame.p
--	orientDigaBot2 = Bot2PositionCFrame*Bot2ApplyRotationCFrame*Bot2RotationCFrame
--	Bot2:SetPrimaryPartCFrame(orientDigaBot2)
	Bot2.Parent = BotMaster
--	print("Bot2LookVectorAfterSecondOrientation=",Bot2.MainPart.CFrame.LookVector)
	print("Bot2 Parented Wait")
--	wait(waits)

	scanWeld(Bot2, Bot2)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w3 = Instance.new("WeldConstraint")
	w3.Part0 = AP.LowerTorso
	w3.Part1 = Bot2.MainPart
	w3.Name = "WC_Bot2"
	w3.Parent = BotMaster
	Bot2.MainPart.Anchored = false
	print("Bot2 Anchoring Wait")
	wait(waits)
	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = BotMaster.Screen.Attachment
	beam.Width0 = 0.2
	beam.Attachment1 = Bot2.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_Bot2"
	beam.Parent = BotMaster
	print("Bot2 Beam Wait")
	wait(waits)
	BotMaster:WaitForChild("Beam_Bot2").Transparency = BeamOFF
	
	
	print("Equiped")
end)

And further on. Added back the orientation so the blue Bots faced forward and then set the second Bots Parent so it could be seen and after a wait reset the Parent and did the orientation to turn right 45 and set the Parent to its final location and… the Bot turned upward as well as rightwards.
So still need help.

Uploaded RBXL
ReproModelAndBeam.rbxl (18.4 KB)
and Code here

print("Hello world!")
local Players = game:GetService("Players")
local LP = Players.LocalPlayer
local PlrGui = LP:WaitForChild("PlayerGui")
local PN = LP.Name 
print ("PlayerName="..PN)
local AP = workspace:WaitForChild(PN)
local HRP = AP:WaitForChild("HumanoidRootPart")
local Controller = script.Parent
local color1 = Color3.fromRGB(251,255,183)
local color2 = Color3.fromRGB(255,255,15)
local colorSeq = ColorSequence.new(color1,color2)
local parts = {}
local BeamOFF = NumberSequence.new({
	NumberSequenceKeypoint.new(0,1),
	NumberSequenceKeypoint.new(0.5,1),
	NumberSequenceKeypoint.new(1,1),})

local function scanWeld(parent,Bot)
	for _,v in pairs(parent:GetChildren()) do
		if (v:IsA("BasePart")) then
			if v.Name ~= "MainPart" then
				local w = Instance.new("WeldConstraint")
				w.Name = ("WC_%s"):format(v.Name)
				w.Part0 = Bot.MainPart
				w.Part1 = v
				w.Parent = Bot.MainPart
				table.insert(parts,v)
				scanWeld(v)
				wait(0.05)
			end
		end
	end
end

Controller.Equipped:Connect(function()
	print("Equiping")
	local waits = 3
	local RS = game:GetService("ReplicatedStorage")
	local APLTCF = AP.LowerTorso.CFrame
	local Controller = AP:WaitForChild("Controller")
	local Handle = Controller:WaitForChild("Handle")
	print("Handle set Wait")
	wait(waits)
	local BotMaster = RS.BotMaster:Clone()
	BotMaster.Parent = Handle	
	local BotMasterOffset = Vector3.new(-0.5,0,-1.25)
	local BotMasterOrientation = CFrame.Angles(0,0,math.rad(90))
	local APLTCF = AP.LowerTorso.CFrame
	local BotMainPartCFrameAdjustment = APLTCF + BotMasterOffset
	BotMaster:SetPrimaryPartCFrame(BotMainPartCFrameAdjustment)

	scanWeld(BotMaster, BotMaster)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w1 = Instance.new("WeldConstraint")
	w1.Part0 = Handle
	w1.Part1 = BotMaster.MainPart
	w1.Name = "WC_BotMaster"
	w1.Parent = Handle
	BotMaster.MainPart.Anchored = false
	print("BotMaster Anchoring Wait")
	wait(waits)

	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = AP.UpperTorso.BodyFrontAttachment
	beam.Width0 = 0.2
	beam.Attachment1 = BotMaster.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_BotMaster"
	beam.Parent = AP.UpperTorso
	print("BotMaster Beam Wait")
	wait(waits)
	AP.UpperTorso:WaitForChild("Beam_BotMaster").Transparency = BeamOFF
	
	local Bot = RS.Bot:Clone()
	wait(1)
	print("BotLookVectorB4=",Bot.MainPart.CFrame.LookVector)
	local BotMainPartCFrameAdjustment = CFrame.new(0,0,0)
	local BotOffset = Vector3.new(0,-0.25,-6)
	local OffsetDiff = APLTCF.LookVector + BotOffset
	BotMainPartCFrameAdjustment = APLTCF + BotOffset
	Bot:SetPrimaryPartCFrame(BotMainPartCFrameAdjustment)
	local BotOrientation = CFrame.Angles(-math.rad(90),0,0)
	local orientDigaBot = CFrame.new(Bot:GetPrimaryPartCFrame().Position) * BotOrientation
	Bot:SetPrimaryPartCFrame(orientDigaBot)
	Bot.Parent = BotMaster
	print("Bot Parented Wait")
	wait(waits)
	scanWeld(Bot, Bot)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w2 = Instance.new("WeldConstraint")
	w2.Part0 = AP.LowerTorso
	w2.Part1 = Bot.MainPart
	w2.Name = "WC_Bot"
	w2.Parent = BotMaster
	Bot.MainPart.Anchored = false
	print("Bot Anchoring Wait")
	wait(waits)
	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = BotMaster.Screen.Attachment
	beam.Width0 = 0.2
	beam.Attachment1 = Bot.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_Bot"
	beam.Parent = BotMaster
	print("Bot Beam Wait")
	wait(waits)
	BotMaster:WaitForChild("Beam_Bot").Transparency = BeamOFF
	
	local Bot2 = RS.Bot:Clone()
	wait(1)
	print("Bot2LookVectorB4=",Bot2.MainPart.CFrame.LookVector)
	local Bot2MainPartCFrameAdjustment = CFrame.new(0,0,0)
	local Bot2Offset = Vector3.new(3.75,-0.25,-3.75)
	local OffsetDiff2 = APLTCF.LookVector + Bot2Offset
	Bot2MainPartCFrameAdjustment = APLTCF + Bot2Offset
	Bot2:SetPrimaryPartCFrame(Bot2MainPartCFrameAdjustment)
	local Bot2Orientation1 = CFrame.Angles(-math.rad(90),0,0)	-- same as bot1
	local orientDigaBot2 = CFrame.new(Bot2:GetPrimaryPartCFrame().Position) * Bot2Orientation1
	Bot2:SetPrimaryPartCFrame(orientDigaBot2)
	local Bot2Parent = Bot2.Parent
	Bot2.Parent = BotMaster
	print("Bot2Orientation OK?")
	wait(waits)
	Bot2.Parent = Bot2Parent
	local Bot2Orientation2 = CFrame.Angles(0,math.rad(45),0)	-- same as bot1 with right turn 45
	orientDigaBot2 = CFrame.new(Bot2:GetPrimaryPartCFrame().Position) * Bot2Orientation2
	Bot2:SetPrimaryPartCFrame(orientDigaBot2)
	Bot2.Parent = BotMaster
	print("Bot2 Parented Wait")
	wait(waits)

	scanWeld(Bot2, Bot2)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
	local w3 = Instance.new("WeldConstraint")
	w3.Part0 = AP.LowerTorso
	w3.Part1 = Bot2.MainPart
	w3.Name = "WC_Bot2"
	w3.Parent = BotMaster
	Bot2.MainPart.Anchored = false
	print("Bot2 Anchoring Wait")
	wait(waits)

	local beam = Instance.new("Beam")
	beam.FaceCamera = true
	beam.Attachment0 = BotMaster.Screen.Attachment
	beam.Width0 = 0.2
	beam.Attachment1 = Bot2.MainPart.Attachment
	beam.Width1 = 0.2
	beam.Color = colorSeq
	beam.Name = "Beam_Bot2"
	beam.Parent = BotMaster
	print("Bot2 Beam Wait")
	wait(waits)
	BotMaster:WaitForChild("Beam_Bot2").Transparency = BeamOFF
	
	
	print("Equiped")
end)

From experimentation is looks like the orientation is using YXZ instead of XYZ.
I have my game using that and it appears stable.

1 Like