Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to save tools in a table with a special ID for each tool?

Asked by 6 years ago

This is just a thought of mine. Obviously scripts that save tools in the backpack are very different and not as reliable as stat saving. But what if you could save tools as a stat? For example, let’s say Billy Bob has a speed coil and a gravity coil, purchased from some shop in the game he is playing. Instead of using other scripts, would it be possible to save it as some kind of number or value?

Each tool can have a unique ID of some sort. For example: Gravity Coil ID: A Speed Coil ID : B If the player owns both tools, their stat would be “AB” The stat should have letters in order from a to z. The unique values could not be numbers because adding 2 IDs together could result in the same number as the sum of two other IDs. Lets add another tool to this, a rocket. Rocket ID: C If the player owns A and C but not B, their stat would be AC. Let me know if you understand, and if you can make anything like this I would be greatful. I havent seen this anywhere else so I thought I might bring it up.

0
Using it to save tools? Use datastore and checks if player has something number then it gives the tool that matches the number, use elseif if you have more numbers. NetworkEngineer 0 — 6y
0
Yes it's possible, and something I could make. Don't expect me to do it for you. CootKitty 311 — 6y

1 answer

Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago
Edited 6 years ago

Yes it is possible. I however will not give you a script. You can do to go through the backpack and add tool id's. I expect you to understand the format of tools, seeing this isn't a site where I will give you the entire thing.

local Id = {}
for i, v in pairs(Player.Backpack:GetChildren()) do
    if v.ClassName == "tool" then
        table.insert(Id, v.ToolId.Value)
    end
end

EDIT: The 'AC' part would require string manipulation and tables. Why not just use a table of ids?

Ad

Answer this question