--Kyles45678


if not game:IsLoaded() then
	game.Loaded:Wait()
end

local ply = game.Players.LocalPlayer
local inGame = ply:WaitForChild("InGame")

local repStoreService = game:GetService("ReplicatedStorage")
local userInputService = game:GetService("UserInputService")

local gui = script.Parent

local defaultView = gui.Default
local mobileView = gui.Mobile

local gameFolder = repStoreService:WaitForChild("Game")
local IM = require(gameFolder.Modules:WaitForChild("IsMobile"))

local function toggleGameUI()
	local ism = IM.isMobile()
	defaultView.Visible = not ism
	mobileView.Visible = ism
end

toggleGameUI()

userInputService.InputBegan:Connect(function(inputObj, GPE)
	--if GPE then return end
	if inputObj.UserInputType == Enum.UserInputType.MouseMovement and userInputService.MouseEnabled and mobileView.Visible then
		toggleGameUI()
	elseif inputObj.UserInputType == Enum.UserInputType.Touch and not userInputService.MouseEnabled and defaultView.Visible then
		toggleGameUI()
	end
end)

local function onInGameChange()
	gui.Enabled = inGame.Value
end

inGame.Changed:Connect(onInGameChange)
onInGameChange()


