Trying to achieve a sine wave but don't know how to execute it

local INCREMENT = 0.05
local angle = 0

while true do
	print(math.sin(angle))
	angle = angle + INCREMENT
	wait()
	if angle >= (math.pi * 2) then
		angle = 0
	end
	print(angle)
end

As x increases, y (angle) oscillates* between 1 and -1. You can use the value of math.sin(angle) in your script.
And as @Kacper pointed out, you’ll want to set angle to 0 when it reaches 2 * PI

8 Likes