I have made a script for my game and copied it 195 times (each country) and now I just realized the wait time is too low so it is exceeding API limits, so how would I edit the scripts in bulk. PS: Sorry if this doesn’t go into this category, but I thought it would.
Are all scripts exactly the same?
Yes. All scripts are exactly the same.
It sounds like it’s good to untilise CollectionService](CollectionService | Documentation - Roblox Creator Hub)
Here’s a tutorial that might help:
https://www.youtube.com/watch?v=-oPE0PL2Zew&t=42s
Instead of having the same script 195 times, you should probably have just one script that loops through an array of objects that you want the script to affect.
CollectionService is useful for this. You can add tags to objects using this service, and loop through all objects that the tags are assigned to.
In this case 1 you can only use 1 script to manage all countries. Ima give you a short idea of what I mean.
local countries = workspace.countries
for _,country in pairs(countries:GetChildren()) do
-- Whatever countries do in your game
end
Edit: As I see ColelctionService is also suggested. Its a better way to handle this. Kinda depends on what your countries are doing
Make sure you do countries:GetChildren()
instead of just countries
.
local countries = workspace.countries
for _,country in pairs(countries:GetChildren()) do
-- Whatever countries do in your game
end