So, i want to make a horror game with max inventory slot. but i don't know how to make it. have any ideas?
If I am not mistaken, in roblox the inventory is initially endless.
You need a Server Script with a function called from the Client.
local ItemBackground = workspace.Items local MaxInventory = 1 -- max inventory local function Take(player,object) -- for i = 1, player.Backpack:GetChildren() do -- take all weapons from the Backpack for i, v in pairs(player.Backpack:GetChildren() do -- take all weapons if i == MaxInventory then -- if weapons is 1 -- if weapon is 1 inside the player inventory local weap = ItemBackground[object]:Clone() -- clone the item in ground weap.Parent = player.Backpack -- insert the weapon inside the player Backpack ItemBackground[object]:Destroy() -- ddestroy item in ground local Clone = v:Clone() -- clone the item inside the Backpack Clone.Parent = ItemBackground -- put the item in ground else local weap = ItemBackground[object]:Clone() weap.Parent = player.Backpack -- insert the weapon inside the player Backpack ItemBackground[object]:Destroy() end end end
You need create a folder in workspace and call it "Items", inside this folder add all your object inside the workspace.
You need call "Object" value from the client
I can't write a code without information, but is something like this. You need connect this function.