The title may sound a bit confusing but I'll make an example.
I'm using DataStore to save some player equipment, but to retreive some values they need to come in a string and numbers to avoid needing to create an addictional DataStore.
Let's say in the following script I get a string value with the value "Pills_5". "Pills" is the name of the item and the number is the number of the items the player has. I need to remove the "Pills_" and only leave the number so I can set that number as the anmount of "Pills" the player has. Here's a short version of a script of what I want to do:
--DataS is a table with the values which was retreived from the DataStore
print(dataS.Pills) --Result: Pills_5, I need to remove the "Pills_"
player.Items.Pills.Name = "Pills"
player.Items.Pills.Value = dataS.Pills --Need to only show "5" and remove the "Pills_"
How would I do so? Is it possible to save a table such as:
local MyBoitifullTable = {Pills = 5,Medkit = 2}
and then retreive it?
Help is appreciated!

7 comments
use string.match, and idk if you could also do that with a dictionary
use string.sub("Pills_5", 6). #"Pills_5" is 7, meaning Pills_ is 6, so anything after the sixth substring will be returned. 5 will be the output
or you can also do string.match("Pills_5", "%d")
Mind making that an answer so it's a bit easier to understand and so I can give you some rep?
you can upvote comments
To make it apply for any situation just do local num = string.match(dataFromDataStore, "%d") and you will be able to access the amount of items that they have.
Alright, thanks guys.