Basically the title. All answers are appreciated!
Module scripts can be accessed from the Client only or the Server only, both the Client and the Server cannot access the module script at the same time. If you were to modify the module script by the Client and the Server then it will create 2 copies because anything done on the server cannot be seen by the client.
So I would need to make a separate module script for the server and the client?
I’m guessing so, I put a module script in ReplicatedStorage if I want it to be accessed by the client and I would put the module script in ServerScriptService so that it can be accessed by the server.
A module script can be required from both the client and server at the same, and nothing will happen.
But the problem is, changes made in module script on server won’t be replicated to client, and vice versa.
So in brief, Yes, you can require module script from server and client, but they will act like two seperate copies for each.
So if I have this function in my module script, would it work for both the server and the client since all the objects I’m referencing are passed to the function?
function actions.CopyCardUI(original, parent)
print("Replicating Card UI")
local UIItems = {}
for key, object in pairs(original:GetChildren()) do
table.insert(UIItems, #UIItems + 1, object:Clone())
end
for key, object in pairs(UIItems) do--Add interface items
object.Parent = parent
--Make the background colors correct
if object.Name == "Pic" then
object.Parent.BackgroundColor3 = object.Title.BackgroundColor3
end
end
end
Module scripts can be accessed by client and server scripts, not just one or the other.
Module scripts can be placed in ReplicatedStorage
, but it does not allow sharing environment between client/server. If the module script was required by either client or server, they will be limited to their respective interaction; client for client and server for server.
Yes, it will work for both the server and the client.
Yep! As long as it’s not called at the same time.
So I have a module that stores settings of a certain skill and I want to place it in ReplicatedStorage to simulate their cooldowns with a UI for the clients while the server does the actual cooldown. If an exploiter modifies the values, those modified values are only seen by the exploiter who modified them, while for the server it’ll not be changed, right?
are code injection attacks possible with ModuleScripts residing on the ReplicatedStorage?