So I tried adding controller support to my game but functions will run despite the gui not being shown.

Here's an example one:

(local script)

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
end)

wait()
if game:GetService("UserInputService").GamepadEnabled then
	
	script.Parent.Text = "Press (X) to exit"
	
end

game:GetService("UserInputService").InputBegan:connect(function(input)
	if input.UserInputType == Enum.UserInputType.Gamepad1 then
		if input.KeyCode == Enum.KeyCode.ButtonX then
			script.Parent.Parent.Visible = false
		end
	end
end)

Is there a way to have it be activated like mousebutton1click?

2 comments

1

Line 12 Connect not connect. Instead of MouseButton1Click on line 1, do Activated instead

0

What I want this to do is if the parent receives the button it will only go through for the parent object