I don’t know whether this behaviour is intentional or not, but basically if you put a Script
with Client
RunContext
in ReplicatedStorage
, the script will run. This does not happen with LocalScript
s or Script
s with any other RunContext
.
I need to somehow find a workaround for this. To note, I can’t use LocalScript
s, since I will be pasting models from ReplicatedStorage
to Workspace
and I need for the scripts to run.
It is intentional, though the Client scripts only run on the Clients, and do not replicate to the server.
I’m not quite sure why you can’t make a LocalScript and reference the models in ReplicatedStorage. You can always put the LocalScript in StarterPlayerScripts or StarterCharacterScripts to have them run.
The reason I can’t use a LocalScript
is because I am pasting the model into Workspace
on the client’s side, and LocalScript
s do not run in Workspace
unless parented to a player character. I did find a workaround which is simply adding this line of code at the beginning:
if script:IsDescendantOf(game:GetService("ReplicatedStorage")) then
return
end
Because it isn’t rlly a LocalScript and the one you changed is just emulated to everyone in a client, you’re basically changing what side it should run between server and client
so to summarize it, you’re just changing the way it runs, LocalScript works in 4 places but Script with RunContext on client runs everywhere cuz the Class name is still a Script.