What to does "Orientation cannot be assigned to" mean?

No clue what im doing wrong, trying to change the orientation of the players arms after i attach them onto a viewmodel, although it just errors with
heres the code

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local RunService = game:GetService("RunService")
repeat task.wait() until game:IsLoaded()
repeat task.wait() until Character:IsDescendantOf(workspace)

local Rs1

local RightArmMotor = Character:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder")
local LeftArmMotor = Character:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder")

local FTorso = Instance.new("Part")
FTorso.Anchored = true
FTorso.CanCollide = false
FTorso.CanQuery = false
FTorso.CanTouch = false

FTorso.Size = Vector3.new(
	math.floor((Character.UpperTorso.Size.Y + Character.LowerTorso.Size.Y)),

FTorso.Parent = workspace
RightArmMotor.Part0 = FTorso
LeftArmMotor.Part0 = FTorso

local function d()
	local lasttime = os.time()
	local movedelay = 3
	Rs1 = RunService.RenderStepped:Connect(function()
		if os.time() - lasttime > movedelay then
			lasttime = os.time()
			FTorso.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0,-1,0)

local TorosCoro = coroutine.create(d)

local Anim = script.Animation

local Animator = Character:FindFirstChildWhichIsA("Humanoid").Animator

print(RightArmMotor.C0.Orientation) -- Errors with "Orientation is not a valid member of CFrame"
RightArmMotor.C0.Orientation = CFrame.fromOrientation(math.rad(90),0,0) -- Errors with "Orientation cannot be assigned to"
LeftArmMotor.C0.Orientation = CFrame.fromOrientation(math.rad(90),0,0) -- Errors with "Orientation cannot be assigned to"
1 Like

I believe what you are looking for is the Rotation? Not Orientation.

The error “x” cannot be assigned to means that you attempted to change or assign a value to a property but that isn’t allowed. You can’t write to/change properties of a CFrame nor is “Orientation” a property of a CFrame - you might’ve intended to use “Rotation” instead

If you want to change a CFrame, you will have to construct a new CFrame. Since you desire to change the orientation/rotation only, you will have to create a CFrame with the same position, but the orientation is different:

-- Since the orientations are the same, consider storing it in a variable
-- and using that variable
local orientation = CFrame.fromOrientation(math.rad(90), 0, 0)
RightArmMotor.C0 = CFrame.new(RightArmMotor.Position) * orientation
LeftArmMotor.C0 = CFrame.new(LeftArmMotor.Position) * orientation

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.