So I’m trying to make it so that a script can find an object by the first letters of it’s name and keeps going until there’s a space.
Basically, there is a folder and it contains many objects with names like
id_8 | Hammer
id_9 | Box
id_10 | Wrench
and the script is given a value 9
and it looks for the object id_9 | Box
and it accesses the tables inside the object (the object is a ModuleScript).
I’m really inexperienced with strings and don’t know how to do this.
Maybe I’ll try to experiment around with it and see what I can do
Your best bet would be to read throught this entire documentation and try to understand it, or look up some youtube tutorials.
1 Like
There’s not a tutorial on string.match
but string.find
. Would it be possible if I wrote out something like:
for _, v in pairs() do
if string.find(v.Name, "id_"..id) then
--access some stuff
end
end
I think so, just play around with it and see what works.