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

Problem with CFrame?

Asked by 9 years ago

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

Log in to vote
0
Answered by
duckwit 1404 Moderation Voter
9 years ago

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.

Ad

Answer this question