#Which method is better?
29 messages · Page 1 of 1 (latest)
is it possible to find all children with the same name in a folder?
yes but why would you want that?
you're best off just making a script that manages the data instead
So player X mines 1 stone:
then in the table for player X you just add 1 to the stone value
looking through tables take performance so if you plan to constantly check the table values id suggest doing actual values instead
either or works but really depends
Yes, yet for constantly reading them I would just have it all inside a table. Just have the key be the Name of said ore and the value be the amount you have. Then it won't be too much more resource intensive the check the inventory yet still easy to move to a new script in case other scripts need to read/write from/to the table
i see
I do have to quickly add that it really depends on how you handle resources. If they're just numbers then tables. If they're all their own item then use values
alr, ty
I believe tables are more convenient and flexible
however, you may encounter problems sharing this table between scripts
search up what is single script architecture
it help with thatreally well
oh also theres _G (i forgot it existed)
i plan on adding quite a lot of ores, and since you would probably have more than a 100 of some ores at a time it could cause lag, which is my worry.
ill do that, thanks
I dont really know why but no one of experienced scripters I know use _G
just have the amount just be a number, then the name of the ore is the key 🤷♂️
we tend to prefer module scripts
and I dont use it either
yes me too
Most scripters just say "Hey I already have a module, why not just add it to the module if I need it everywhere"
im experimenting with Knit rn
do you know if its worth using?
local ExampleTable = {
["Stone"] = 0,
["Iron"] = 0,
["Gold"] = 0
}
local function AddOre(Ore, NumberToAdd)
if not ExampleTable[Ore] then warn("This ore does not exist") return end
ExampleTable[Ore] += NumberToAdd
end
then it doesn't matter how many hours need to be added, as long as it stays under the intlimit (which is already way too high)
Never looked at knit before. I can't say
i see, it's pretty similar to the system i was using before so ill probably stick to that. thanks