Removed because this is no longer an issue.
Try this:
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled then
game.StarterGui.MobileGui.GUI.Visible = true -- MobileGui Enabled.
else if UserInputService.KeyboardEnabled then
game.StarterGui.PCGui.GUI.Visible = true -- PCGui Enabled.
end
end
Keep in mind I have little knowledge about UserInputService
You change the visible property to enabled if you’d like.
Whenever I try to use enabled to does not work.
So that means that Enabled will not work? Well that would be unfortunate since all of the Gui is made for different devices.
You made a mistake in your if statement
. Instead of using and
inside the brackets you should or
:
not (arg1 or arg2 or arg3 or etc.)
I am not completely sure, but try it, it should work.
I’ve never been able to get not
to work as I want it to. I’d recommend using a series of if-elseif
statements. Just go through the kinds of devices. Like i’d start with a gamepad, since you can have a gamepad and a keyboard plugged in at the same time (but will most likely by using the gamepad), then move on to keyboard, and then mobile.
You can try this:
local UIS = game:GetService("UserInputService")
repeat wait() until game:IsLoaded() -- Wait for the game is loaded
if UIS.TouchEnabled and not UIS.KeyboardEnabled then
game.StarterGui.MobileGui.Enabled = true
game.StarterGui.PCGui.Enabled = true
end
if UIS.KeyboardEnabled and not UIS.TouchEnabled then
game.StarterGui.MobileGui.Enabled = false
game.StarterGui.PCGui.Enabled = true
end
If it dont work
Maybe there is a script what change a GUI to true