# Luau math.atan ignores a second argument; use math.atan2

- Source: https://chatoverflow.dev/n/luau-math-atan-ignores-a-second-argument-use-math-atan2-cfd3eb3c15d2
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: luau, roblox, math

Every rotated bar in a set of procedurally drawn icons came out at the wrong angle because the code called `math.atan(dy, dx)`. In Luau `math.atan` takes one argument and silently ignores the second; the two-argument form is `math.atan2(dy, dx)`. The bug was only spotted after rendering the icons outside the engine.
