Simple Circular Joystick visualizer

,

A script that shows controller joystick movement as a GUI in a circular movement.

(The anchor point of the joystick must be 0.5, 0.5 for this script to work. You could modify it to support other anchor points though.)

local UIS = game:GetService("UserInputService")

local Frame = script.Parent
local Joystick = Frame.Joystick

UIS.InputChanged:connect(function(input, processed)
	if input.UserInputType == Enum.UserInputType.Gamepad1 then
		if input.KeyCode == Enum.KeyCode.Thumbstick1 then
			local Horizontal = input.Position.X
			local Vertical = input.Position.Y
			
			Joystick.Position = UDim2.new((0.5 * Horizontal), 0, -(0.5 * Vertical), 0) + UDim2.new(0.5,0,0.5,0)
		end
	end
end)
6 Likes