Help With Controller Anti Cheat -- Against Third Party Hardware Devices

I want to make a server sided controller anti cheat system, that helps to stop controller players, from using things like aimbot, or third party hardware devices, like the cornus zen, or max, that aren’t detected by ROBLOX. (I am aware of Byfron, but still for the meantime, and i’m not sure it’s going to combat controller exploits)

I tried programming this in a server script it just doesn’t work. I’m not sure why, I don’t get any errors in the dev console. Also can someone point me in the right direction when it comes to combatting third party hardware devices, this script is only for regular, unexpected controller behavior. Thanks!

local MAX_INPUT_RATE = 10
local CONSECUTIVE_INPUTS_THRESHOLD = 5
local INPUT_WINDOW = 2

local function isController(inputObject)
	-- Check if the input object comes from a controller
	return inputObject:IsA("UserInputState") or inputObject:IsA("InputObject")
end

local function onInputBegan(input, gameProcessedEvent)
	if not isController(input) then
		return
	end

	local player = game.Players:GetPlayerFromCharacter(input.User)
	if not player then
		return
	end

	if input.UserInputType == Enum.UserInputType.Gamepad1 or input.UserInputType == Enum.UserInputType.Gamepad2 then
		-- The player is using a controller

		-- Initialize a table to track input timestamps
		player.ControllerInputs = player.ControllerInputs or {}

		-- Remove old input timestamps from the table
		local currentTime = tick()
		for i = #player.ControllerInputs, 1, -1 do
			if currentTime - player.ControllerInputs[i] > INPUT_WINDOW then
				table.remove(player.ControllerInputs, i)
			end
		end

		-- Add the new input timestamp to the table
		table.insert(player.ControllerInputs, currentTime)

		-- Check if the player has exceeded the maximum input rate
		if #player.ControllerInputs >= MAX_INPUT_RATE then
			-- Calculate the time between the first and last input
			local timeBetweenFirstAndLastInput = player.ControllerInputs[#player.ControllerInputs] - player.ControllerInputs[#player.ControllerInputs - MAX_INPUT_RATE + 1]

			-- Check if the time between the first and last input is below the threshold
			if timeBetweenFirstAndLastInput < (1 / CONSECUTIVE_INPUTS_THRESHOLD) then
				player:Kick("KICKED BY WOLF - Exploiting with controller")
			end
		end
	end
end

game:GetService("UserInputService").InputBegan:Connect(onInputBegan)

i dont think you can get player input on a server script