How to change the arm position?

Hi, i’m trying to change the position and the orientation of an arm of an r6 character whit a script into a tool.
But the script report errors.

error1
error2

Script:

local tool = script.Parent.Parent
local Character = plr.Character or plr.CharacterAdded:Wait()
local torso = Character.Torso

tool.Equipped:Connect(function()
	torso["Right Shoulder"].C0.Rotation = Vector3.new(1, 95, 90)
	torso["Right Shoulder"].C0.Position = Vector3.new(1, 2, 8)
end)

I also tried using the CFrame but it didn’t work.

Thanks

torso["Right Shoulder"].C0 = torso["Right Shoulder"].C0 * CFrame.new() -- Like this
torso["Right Shoulder"].C0 = torso["Right Shoulder"].C0 * CFrame.Angles() -- Like this
torso["Right Shoulder"].C0 = torso["Right Shoulder"].C0:Lerp() -- Also this

im3

The arm should have this position

im4

local tool = script.Parent.Parent
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local torso = Character:WaitForChild("Torso")


tool.Equipped:Connect(function()
	torso["Right Shoulder"].C0 = torso["Right Shoulder"].C0 * CFrame.new(1, 0.5, -0.3) 
	torso["Right Shoulder"].C0 = torso["Right Shoulder"].C0 * CFrame.Angles(1, 95, 90) 
end)

The problem with your code is that you can’t assign a Vector3 value to the rotation and position properties of CFrame. Rotation and position need to be assigned to a CFrame value. To fix this, you can use the CFrame.fromEulerAnglesXYZ() function to convert your Vector3 values into a CFrame value. The code should look something like this:


local tool = script.Parent.Parent
local Character = plr.Character or plr.CharacterAdded:Wait()
local torso = Character.Torso

tool.Equipped:Connect(function()
	torso["Right Shoulder"].C0 = CFrame.fromEulerAnglesXYZ(1, 95, 90)
	torso["Right Shoulder"].C0.Position = Vector3.new(1, 2, 8)
end)

That is very much not the issue and this code will cause an error.

Additionally, it is not reliable to change the C0 of any animatable Motor6Ds due to an update breaking them.


CFrame.Angles is in radians, unlike the properties window. Change to CFrame.Angles(math.rad(1), math.rad(95), math.rad(90))

I don’t know why it doesn’t work

I think the “Hand up” of the tool interferes with the script.

Is there another way to change the arm position?

You can use this method but change the CFrame you set or use an Animation to change the arm position.

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