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

why won't GUI become invisible after player is on keyboard?

Asked by 4 years ago
Edited 4 years ago

When a player connects with a controller a gui becomes visible. I want to make it so If they were to switch to keyboard the gui will no longer be visible but its not working and I am not sure why. Please bear with me for I am a beginner.

local gui = script.Parent

local XboxWorkpls = gui.Frame

local UserInputService = game:GetService("UserInputService")

UserInputService.InputChanged:Connect(function(input, processed)
    if input.UserInputType == Enum.UserInputType.Gamepad1 then
        if input.KeyCode == Enum.KeyCode.Thumbstick1 then
            XboxWorkpls.Visible = true
        end
    end
end)

local gui = script.Parent

local XboxWorkpls = gui.Frame

local UserInputService = game:GetService("UserInputService")

UserInputService.InputChanged:Connect(function(input, processed)
    if input.UserInputType == Enum.UserInputType.Keyboard then
        if input.KeyCode == Enum.KeyCode.W then
            XboxWorkpls.Visible = false
        end
    end
end)

0
What error are you getting? relatlves 17 — 4y
0
none it just doesn't seem to work SilverishReign 75 — 4y

Answer this question