the localscript checks if there is a controller in use or something but, when I have my controller already plugged in, it doesn't appear, but when I unplug and plug it back in, it's visible, I don't understand...
local plr = game:GetService("Players").LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local UIS = game:GetService"UserInputService" UIS.GamepadEnabled:Connect(function() print("gamepad detected") script.Parent.YButton.Visible = true script.Parent.HoldLabel.Visible = true end)
The GamepadEnabled
event only fires when a user plugs in a gamepad.
This means that if the player already had one plugged in, it would not fire, since he did not just plug it in. However, you can get already connected gamepads by using other UserInputService functions such as
GetGamepadConnected(UserInputType gamepadNum)
which returns true or false if the inputted gamepad is connected
GetConnectedGamepads()
which returns all the connected game pads.
Hope this helps.