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.
That is the layout for my door.
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
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.
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.