if not game:IsLoaded()then game.Loaded:Wait()end local L=game.Players.LocalPlayer local w=L:WaitForChild("\073\110\071\097\109\101")local F=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local K=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local z=script.Parent local b=z.Default local A=z.Mobile local B=F:WaitForChild("\071\097\109\101")local m=require(B.Modules:WaitForChild("\073\115\077\111\098\105\108\101"))local function q()local L=m.isMobile()b.Visible=not L A.Visible=L end q()K.InputBegan:Connect(function(L,w)if L.UserInputType==Enum.UserInputType.MouseMovement and(K.MouseEnabled and A.Visible)then q()elseif L.UserInputType==Enum.UserInputType.Touch and(not K.MouseEnabled and b.Visible)then q()end end)local function Y()z.Enabled=w.Value end w.Changed:Connect(Y)Y()


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()


