I want to know a script that makes items in your inventory carry acrross servers
What do you mean by this? Like on leave and join? Just use a Datastore and save it on leave, load it on join
yeah so like if i leave the game i want my items to save
Did you click on @OfficialPogCat’s link to read the documentation?
If you save items to Datastores for each player then you can have them available in their inventories when they rejoin.
Use a datastore (like said) to save the objects. This is a basic example, I would recommend modifying it:
local function encodeInventory(TableOfInventory)
-- Adds every inventory item's name into a string
local encoding = ""
for _, inventoryItem in TableOfInventory do
encoding = encoding..","..inventoryItem.Name
end
return encoding
end
local function decodeInventory(encoding)
-- Returns the name of every inventory item saved
return string.split(encoding, ",")
end
Save the string returned from encodeInventory(inventory)
to a DataStore. When the player loads back into the game, give every item listed from decodeInventory(encoding)
into the player’s inventory:
for _, item in decodeInventory(encoding) do
local item = game.ReplicatedStorage:WaitForChild("your items folder"):FindFirstChild(item)
item:Clone().Parent = player.Backpack
end
Make sure to hook up your items folder
to whatever folder keeps all your inventory items.
im pretty new to scripting anybody mind telling me how to make and where to put the data store