Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

bad argument #3 to 'Angles' (number expected, got no value)?

Asked by
BiIinear 104
4 years ago

I'm trying to make it where if you equip a slot, the items part will be cloned and welded onto you, as if you were wearing it. I've made a weld, defined Part1, and now I need it to rotate to its appropriate orientation from a Vector3 value. Instead, it returns an error that makes no sense to my understanding.

weld.Part1 = meshclone
            weld.Part1.CFrame = weld.Part1.CFrame * CFrame.Angles(accval.Rotation.Value)

Any help would be great.

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

The problem is that CFrame.Angles has three number inputs and not a single Vector3 input.

weld.Part1 = meshclone
weld.Part1.CFrame = weld.Part1.CFrame * CFrame.Angles(math.rad(accval.Rotation.Value.X),math.rad(accval.Rotation.Value.Y),math.rad(accval.Rotation.Value.Z))

Another thing to keep in mind is that CFrame.Angles expects you to input the rotation in radians, where 360 degrees is equal to 2 Pi.

You can simply use math.rad to convert degrees into radians.

1
Thank you! Also, it fixed how I set the rotation value. I can finally do 0,0,90 instead of 0,0,1.57 which seems confusing. BiIinear 104 — 4y
0
Nice! remember to accept my answer! Vinceberget 1420 — 4y
Ad

Answer this question