Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Controller not properly detected?

Asked by 4 years ago
Edited 4 years ago

I tried to make a screen where if the controller is enabled and disconnected a GUI will pop up. The controller doesn't get detected though.

Here's my code ( Changed up the code for less bluff)

local UIS = game:GetService("UserInputService")
local controller = false

if UIS.GamepadEnabled then
    print("Player has controller enabled")
    controller = true
end

UIS.GamepadDisconnected:connect(function(gamepad)
if controller then
    print("Player has unplugged controller: " .. tostring(gamepad))
    script.Parent.Visible = true
    wait(5)
    script.Parent.Visisble = false
end
end)

Did I use the gamepadconnected and gamepadconnected properly? Why are there no errors? Do I have to use a 360 or a One Controller?

Note: I tested this on my friends windows computer because I have a mac. Why I don't use my xbox is because I haven't fixed my game yet to be compatible enough for consoles.

Answer this question