Hello, everyone.
I have a game that will be played by both people on Xbox One and people on PC.
The only problem is that while it works if you connect or disconnect a controller while the game is running, and the buttons appear or disappear, respectfully, I can't seem to make it detected an absent gamepad or one that's plugged in currently, making the buttons either disappear or reappear respectfully.
I'd appreciate some help with this. Any help is much appreciated.
while true do
wait(0)
if game:GetService("UserInputService").GamepadEnabled then
game:GetService("UserInputService").GamepadConnected:connect(function(gamepad)
script.Parent.Visible = true --Make the gamepad buttons visible
game:GetService("UserInputService").GamepadDisconnected:connect(function(gamepad)
script.Parent.Visible = false --Make the gamepad buttons invisible
end)
end)
end
end

1 comment
Thank you! This works perfectly. c: