I have 4 default tools in my game and i want mobile players to see all of them. How do i change the number of default inventory slots?
You don’t, you need to add your own custom inventory UI (which is scripted)
I’d figure out how to go with three. They can always press inventory to access the rest.
local StarterGui=game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
local p=game.Players.LocalPlayer
task.wait(2)
local gui=Instance.new("ScreenGui",p:WaitForChild("PlayerGui"))
gui.ResetOnSpawn=false
local frame=Instance.new("Frame",gui)
frame.Size=UDim2.fromScale(1,0.12)
frame.Position=UDim2.fromScale(0,0.88)
frame.BackgroundColor3=Color3.fromRGB(40,40,40)
local layout=Instance.new("UIListLayout",frame)
layout.FillDirection=Enum.FillDirection.Horizontal
layout.HorizontalAlignment=Enum.HorizontalAlignment.Center
layout.VerticalAlignment=Enum.VerticalAlignment.Center
layout.Padding=UDim.new(0,4)
local function update()
for _,b in pairs(frame:GetChildren())do
if b:IsA("TextButton")then b:Destroy()end
end
for _,tool in ipairs(p.Backpack:GetChildren())do
local b=Instance.new("TextButton",frame)
b.Size=UDim2.fromScale(0.1,1)
b.BackgroundColor3=Color3.fromRGB(80,80,80)
b.TextScaled=true
b.TextColor3=Color3.new(1,1,1)
b.Text=tool.Name
b.Activated:Connect(function()
p.Character.Humanoid:EquipTool(tool)
end)
end
end
p.Backpack.ChildAdded:Connect(update)
p.Backpack.ChildRemoved:Connect(update)
update()
Here is a terrible GUI with a quick script in StarterGui.
It’s a start..
create a custom ui for you game because it is the only way fr
if you are lazy to make it then click this link because you can actually customize the inventory slots
Adding onto this, if you want the CoreGui backpack with just more slots, you can use Purse which is a sub project of Satchel.
https://create.roblox.com/store/asset/112061170330936
Just install Purse and edit this line to equal whatever slots you want.
local HOTBAR_SLOTS_MINI = 4 -- Four slots visible on mobile