Hi, i have this inventory Gui that i found and it works perfectly in studio testing but when i test in online the button doesnt work.....online roblox's default inventory GUI is deleted but the inventory button "InvenButton" doesnt do anything
It is a local script
here is the script
player = game.Players.LocalPlayer
game.StarterGui:SetCoreGuiEnabled('Backpack',false)
--
local Enabled = false
function UpdateInventory()
if Enabled == false then
Enabled = true
script.Parent.Frame.Visible = true
script.Parent.Frame.CanvasSize = UDim2.new(0,0,0,20*#player.Backpack:children())
script.Parent.Frame:ClearAllChildren()
for i,v in pairs(player.Backpack:GetChildren()) do
Obj1 = Instance.new('ImageButton',script.Parent.Frame)
Obj1.Size = UDim2.new(0,60,0,60)
Obj1.Position = UDim2.new(0,5,0,65*i-50)
Obj1.BackgroundTransparency = 0
Obj1.Image = v.TextureId
Obj1.MouseButton1Down:connect(function()
player.Character.Humanoid:UnequipTools()
player.Character.Humanoid:EquipTool(v)
end)
end
else
Enabled = false
script.Parent.Frame.Visible = false
end
end
script.Parent.InvenButton.MouseButton1Down:connect(function()
UpdateInventory()
end)
player.Backpack.Changed:connect(function()
if Enabled == false then Enabled = true UpdateInventory() end
if Enabled == true then Enabled = false UpdateInventory() end
end)
could someone point out what is causing it to not work online but work in studio? and maybe provide me with a way to fix it or guide me to fixing it :)

2 comments
:) thanks for this works perfect now. i went ahead and gave it 5 seconds since noone will open their invy within that anyway.. just to make sure it works even if its lags :)
repeat wait(.1) until player.Character Use this actually it starts when character loads