I am trying to make my game compatible for xbox controller so that I will be able to play it on "My games" on xbox or if I plug in my controller to my pc. I am testing it using xbox. Here is my code:

local xboxhelp=script.Parent

	if game:GetService("UserInputService").GamepadEnabled then --here i am trying to see if a gamepad is enabled.
		wait(2)
		xboxhelp.Text="INITIATING..."
		wait(1)
		xboxhelp.Text="INITIATION SUCCESS"
		xboxhelp.BackgroundColor3=Color3.new(128, 255, 0)
	else
		wait(2)
		xboxhelp.Text=("INITIATING...")
		wait(1)
		xboxhelp.Text=("INITIATION FAILED")
		xboxhelp.BackgroundColor3=Color3.new(255, 0, 0)
	end

However even when I am on xbox with a connected wireless controller, the text of the label xboxhelp is INITIATION FAILED (It also says INITIATION FAILED when I run it on mac, but thats not a problem as it's supposed to do that.) Anyone help?

2 comments

0

Is this a LocalScript?

0

^