Changing mass scripts without manually doing it

This may seem like a simple question and more than likely has a simple answer. but I want to change module scripts in my door system in studio without manually going through every door as their is alot of doors.

image

That is the layout for my door.

image

This is the layout of my authorisation.

I have been running this script in the command bar, but it doesnt seem to be actually changing it although it does print.

for i,v in pairs(workspace["F-67"].Doors:GetChildren()) do local mod = require(v.ItemSettings); for item,value in pairs(mod.Ranks) do if item == 5 then print(item);  item = 1; print(item) end end end
1 Like

You could simply just no-clip your body if its optional

I really dont see how this is a fix.

You can delete all the module script but left one of them.
if they are all the same name.

local world = game.Workspace:GetDescendant()
for i =1,#World do
if i >1 and World[i].Name == "ScriptName" then
World[i]:Delete()
end
end

After the you enter the command, look for the last one. then edit it.

If you actually want to change the content of the script, you need to modify its Source property. Requiring it in the command bar will just return an instance of the module for the command bar environment and cache that, so you’re changing the instance rather than the actual code.

Source is a property inherited from the LuaSourceContainer class. It is a representation of the script’s content as a string. Therefore; you will need to do some string manipulation in order to mass-change like you’re hoping for.

Alternatively you can just change your permissions system altogether. The way my game’s doors are handled, we have a “synced” door permission system. Modules per type of clearance are placed in ReplicatedStorage and there’s just a ValueObject in the door referencing which permission to adopt. This divorces needing to put permission scripts in every door except to make door-specific permissions.

3 Likes

Trying to avoid this because each script is different.

So you are assigning the permission for every door?
If yes, you can do what i told you and edit it.
Make it easier to edit permission by adding values.
You can add a value to the parent of your door and name it “LevelRequired” and in future, you don’t need to open your script every time and edit for a long time.