Local Scripts vs Client Run Context

What is the difference between a ‘Local Script’ and a script with the ‘RunContext’ set to ‘Client’ and when should I use one over another?

1 Like

I use a Script with run context of Client for my client loader.

I do this because it can run in ReplicatedStorage instead of StarterPlayerScripts

1 Like

runcontext on client is like basically a script but for client-side only, and it can be run on anywhere, not just your localplayer or character, as x6nnx said it can be run on replicatedstorage, workspace.Terrain (example), any any others, meanwhile a LOCALSCRIPT is just able to work if its parented to your character, playergui or playerscripts or backpack. (i guess)

1 Like

Also ReplicatedFirst iirc local scripts can run, but it’d be :WaitForChild() hell if thats used for anything but pre-loading assets

1 Like

indeed brother, i forgot to state that lol

1 Like

Also to add on, heres an example of how I setup my game I’m working on with my friend.

Client is a Script with RunContext set to Client, and it just requires all the modules in Systems, which none of those require any of the modules inside system, all communcation is done within our Context modules, which just holds reactive states and signals.

And Server is a Script with RunContext set to Server ofc

More so of a data oriented design I guess.

Though this Single-Script Architecture isn’t required, it’s more of a personal preference, as both Multi-Script Architecture and Single-Script Architecture have their own benefits and downfalls.

1 Like

ahh i see thank you,
btw jus curious what do the ‘Context’ scripts do?

There not needed, it’s just the way we set it up, but it holds reactive states, and signals, allowing the System modules to interact without requiring each other.

We also use it for constants that stay the same across all scripts, like images, unicode characters, etc.

ahh i see this is really cool never thought about doing something like this

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.