Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Problem with CFrame?

Why would this be erroring?

ERROR : 23:12:16.649 - Players.Player.PlayerGui.LocalScript:6: bad argument #3 to 'Angles' (number expected, got no value) 23:12:16.651 - Script 'Players.Player.PlayerGui.LocalScript', Line 6 23:12:16.653 - Stack End

wait()

local Player=game.Players.LocalPlayer

while wait() do 
Player.Character.Head.CFrame=Player.Character.Head.CFrame
*CFrame.Angles(workspace.CurrentCamera.CoordinateFrame)
end

1 answer

✓ Accepted answer

By the definition of CFrame.Angles(rx, ry, rz) on the Official ROBLOX Wiki, this constructor should receive rx, ry, and rz as parameters. There should be three individual arguments, each of which is a number value representing the desired rotation in radians (as opposed to degrees) about one of the three axes.

You have passed a CFrame data structure as an argument, which is not expected, and hence you have received the error "bad argument #3 ... got no value". The reason for this error in particular is that, because you only passed one value (a CFrame), the 2nd and 3rd expected values are missing. Lua evaluates function arguments from right to left, so to speak, and so notices that the 3rd argument is missing first, and reports that.

This discussion is preserved as it was. New answers, comments, and votes are closed.