How do I get thumbstick position?

I want to make a crouching script using thumbstick position

--Custom--
local minimum = 1
local maximum = 5
----------

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
		Input:GetPropertyChangedSignal("Position"):Connect(function()
			print(Input.Position.Y)
		end)
	end
end)

but it doesnt print anything? does anyone know why this could be?

1 Like

found the solution.

--Custom--
local minimum = 1
local maximum = 5
----------

local UserInputService = game:GetService("UserInputService")

UserInputService.InputChanged:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
		Input:GetPropertyChangedSignal("Position"):Connect(function()
			print(Input.Position.Y)
		end)
	end
end)

for some reason it doesnt work with UserInputService.InputBegan and it has to be UserInputService.InputChanged

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.