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