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)

2 comments
What error are you getting?
none it just doesn't seem to work