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

How can I make a specific button be activated via xbox controls?v

Asked by 5 years ago

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?

1
Line 12 Connect not connect. Instead of MouseButton1Click on line 1, do Activated instead User#19524 175 — 5y
0
What I want this to do is if the parent receives the button it will only go through for the parent object VeryDarkDev 47 — 5y

Answer this question