Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How does one insert Backpack items into a string?

A while back I asked a question on how I could save a Player's backpack items, and people suggested that I inserted them into a String. The only problem is that I have no idea how to use Strings at all. I tried reading the Wiki, but the Wiki's string article is just confusing, and explains the useless things as opposed to things like this. Thanks!

1 answer

To insert something into a string, I'm assuming that you are looking for a method of storing the names of the tools a player had into a string so they can load them up again.

I like to use Data Persistence because the ROBLOX wiki has a fairly poor explanation of how DataStores work.

You would do this like so: (Not tested)

game.Players.PlayerRemoving:connect(function(player) -- When a player leaves the game
tools = player.Backpack:GetChildren()
for i = 1, #tools do -- Getting all the tools in their backpack
player:SaveString("Tool"..i, v.Name) -- Saving the name of the tool
for i,v in pairs(player.Character:GetChildren()) do
if v:IsA("Tool") then -- Getting tool in character if there is one
player:SaveString("Tool"..i+1,v.Name)  -- Saving the name of the tool
end
end
end
end)

8 comments

0

I know what a String is, I just don't know how to insert things into a String.

0

You said you didn't know how to use strings.

0

I don't know how to use them at an advanced level, I completely understand what you explained.

0

Does my solution work?

0

I have no way to test it. How would I use your way to also load the player's backpack back in when the join?

0

Want me to post the whole script?

0

Yes, that would be lovely.

0

Oh, and if you add it, add it in a new answer please, so I get it in my notifications.

This discussion is preserved as it was. New answers, comments, and votes are closed.