ask the title says the script isnt picking up the gamepad input? i mean its worked before for me using the same method but now its not even printing anything its just acting as if there isnt a controller being used

LocalScript:

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, recieved)
if UIS:GetFocusedTextBox() == nil then
  UIS.GamepadConnected:Connect(function()
  print("Controller Found")
  game.ReplicatedStorage.HasController:FireServer(true)
  print("fired true")
  UIS.GamepadDisconnected:Connect(function()
  print("Controller Lost")
  game.ReplicatedStorage.HasController:FireServer(false)
  print("fired false")
  if UIS.GamepadEnabled == true then
    print("gamepad is enabled")
  end
  end)
  end)
end
end)

dont mind the formatting i took a bunch of unecessary things out of the script (keyboard inputs) and threw it into a lua beautifier