Argument 1 missing or nil

Not sure why this is erroring? Edit: Error on the line that says “Shoulder.Transform = Plane * CFrame.Angles(ShoulderAngle, 0, 0)”

local SolveIK = require(game.ReplicatedStorage.Modules.SolveIK)

	local Plane, ShoulderAngle, ElbowAngle = SolveIK(CFrame.new(), HandTarget, UpperArmLength, LowerArmLength)
	
	Shoulder.Transform = Plane * CFrame.Angles(ShoulderAngle, 0, 0)
	Elbow.Transform = CFrame.Angles(ElbowAngle, 0, 0)
2 Likes

Can you send a screenshot of the error

1 Like

the title is the error that i am getting :DDD, on the line with shoulder.transform

1 Like

What is SolveIK returning?

solveik is set to local SolveIK = require(game.ReplicatedStorage.Modules.SolveIK)

Cool. So what is that function returning?

can you pls send the module script you called for this

They return positions of where they are the module returns CFrame Plane, Radian Shoulder angle, Radian Elbow angle

this the problem. your supposed to give x,y,z

You’re using the values that are returned from your function call to compute new values, but the function is not returning anything for either Plane or ShoulderAngle.

Module returns return planeCF, a1 + math.pi/2, a2 - a1

Try printing ShoulderAngle, I think the error came from CFrame.Angles on the X place

Here you go https://i.imgur.com/5fInrbD.png

Is nil the printed shoulder angle?

1 Like

Yup, that did happen until 3rd try really, or the end

Then check if ShoulderAngle is nil like

local Plane, ShoulderAngle, ElbowAngle = SolveIK(CFrame.new(), HandTarget, UpperArmLength, LowerArmLength)
	
    ShoulderAngle = ShoulderAngle or 0
	Shoulder.Transform = Plane * CFrame.Angles(ShoulderAngle, 0, 0)
	Elbow.Transform = CFrame.Angles(ElbowAngle, 0, 0)

Then it completely breaks, this is a hand moving system using controller

Save the last ShoulderAngle, if its nil then set it to that?

CFrame.new with no arguments creates a new CFrame with an identity matrix. That wouldn’t be the issue.

That is actually the only operation you can do on CFrames. Add, subtract, and divide do not work, whereas multiply does.

1 Like