Mobile Users Can't Open Hat GUI, What am I doing wrong?

Hello Developers! For the past month I have been trying to figure out why I cannot seem to fix this issue where mobile users in my game cannot access the inventory GUI, everyone kept telling me it had something to do with positioning, but it turns out it really isn’t, it’s just that mobile users wont be able to open the GUI for an unknown reason!! hopefully someone here knows how to solve my issue :slightly_smiling_face: Below Is My Current Script I’m Using

local plr = game.Players.LocalPlayer
local char = plr.Character
local Module = require(game.ReplicatedStorage.Crates)
local Frame = script.Parent
local HatsFrame = Frame.Background.Hats
local Select = Frame.Select
local Id = Frame.Id
local Info = Frame.Info

--Frame.Parent.HatsButton.Activated:Connect(function()
	--Frame.Visible = not Frame.Visible
--end)



local function addtemplate(hat, id)
	local template = script.Template:Clone()
	template.Parent = HatsFrame
	template.Name = hat
	template.Id.Value = id
	local Model = game.ReplicatedStorage.Hats[hat].Handle:Clone()
	Model.Parent = template.Png
	local Camera = Instance.new("Camera", template.Png)
	Camera.CFrame = CFrame.new( Vector3.new(Model.Position.X, Model.Position.Y, Model.Position.Z + 2), Model.Position )
	template.Png.CurrentCamera = Camera
	
	template.Activated:Connect(function()
		Select.Value = template.Name
		Id.Value = template.Id.Value
		Info.HatName.Text = template.Name
		Info.Rarity.Text = Module.Hats[template.Name].Rarity
		Info.Boost.Text = "+"..Module.Hats[template.Name].Boost
		Info.Png:ClearAllChildren()
		local Model2 = game.ReplicatedStorage.Hats[template.Name].Handle:Clone()
		Model2.Parent =  Info.Png
		local Camera2 = Instance.new("Camera", Info.Png)
		Camera2.CFrame = CFrame.new( Vector3.new(Model2.Position.X, Model2.Position.Y, Model2.Position.Z + 2), Model2.Position )
		Info.Png.CurrentCamera = Camera2
		
		if template.Equip.Value == false then
			Info.Equip.Text = "Equip"
		else
			Info.Equip.Text = "Unequip"
		end
		
	end)
end

local function find(id)
	local Button = HatsFrame:GetChildren()
	for i = 1, #Button do
		if Button[i]:IsA("TextButton") then
			if Button[i].Id.Value == id then
				return Button[i]
			end
		end
	end
end

game.ReplicatedStorage.Events.AddHat.OnClientEvent:Connect(function(hat, id)
	addtemplate(hat, id)
end)

spawn(function()
	while wait() do
		local TotalStorage = #plr.Hats:GetChildren()
		Frame.Storage.Text = TotalStorage.."/"..game.ReplicatedStorage.Settings.MaxStorage.Value
		local TotalEquipped = #plr.HatsEquipped:GetChildren()
		Frame.Equipped.Text = TotalEquipped.."/"..game.ReplicatedStorage.Settings.MaxHats.Value
	end
end)

local Deb = false
local Deb2 = false

Info.Equip.Activated:Connect(function()
	if Deb then
		return
	end
	Deb = true
	local button = find(Id.Value)
	if Select.Value ~= "" then
		if Info.Equip.Text == "Equip" then
			if #plr.HatsEquipped:GetChildren() <= game.ReplicatedStorage.Settings.MaxHats.Value - 1 then
				Info.Equip.Text = "Unequip"
				button.EquipPng.Visible = true
				button.Equip.Value = true
				button.LayoutOrder = 0
				game.ReplicatedStorage.Events.Equip:InvokeServer(Select.Value, "Equip")
			end	
		else
			Info.Equip.Text = "Equip"
			button.EquipPng.Visible = false
			button.Equip.Value = false
			button.LayoutOrder = 1
			game.ReplicatedStorage.Events.Equip:InvokeServer(Select.Value, "Unequip")
		end
	end
	wait(0.5)
	Deb = false
end)

script.Parent.Options.UnequipAll.Activated:Connect(function()
	game.ReplicatedStorage.Events.Equip:InvokeServer(Select.Value, "All")
	for _,v in pairs(HatsFrame:GetChildren()) do
		if v:IsA("TextButton") then
			v.Equip.Value = false
			v.EquipPng.Visible = false
			v.LayoutOrder = 1
			Info.Equip.Text = "Equip"
		end	
	end
end)

Info.Delete.Activated:Connect(function()
	if Deb2 then
		return
	end
	Deb2 = true
	local button = find(Id.Value)
	if Select.Value ~= "" then
		game.ReplicatedStorage.Events.Delete:InvokeServer(Select.Value, button.Equip.Value)
		button:Destroy()
		Info.Equip.Text = "Equip"
		Info.Png:ClearAllChildren()
		Select.Value = ""
		Id.Value = ""
		Info.HatName.Text = "Hat Name"
		Info.Rarity.Text = "Rarity"
		Info.Boost.Text = "+0"
	end
	wait(1)
	Deb2 = false
end)
1 Like

Please show your script. we cant do anything to fix it without it.

2 Likes

Alright, ill edit my post with the script

It’s a rather long script tbh, hopefully you shouldn’t have to read it all

1 Like

Im really confused. Can you send us a video of trying to open it and what happens? or gif. or you can just send me more information about what did you do to make it open for mobile users when they click it.

1 Like

Are you using a GUI plugin that adds extra touches to the inventory GUI?

Hey! This is a pretty old topic but in the past, I had the same issue.

It’s pretty easy! Use MouseButton1Down than Activated, it should work then.

I also can not see you opening the frame button function, I assume you have taken this script out of a tutorial. Look for the button that says HatButton or HatFrameButtons, something like that. Then edit the script that is inside of it and use MouseButton1Down than activated or MouseButton1click.