Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is the difference between LocalScripts, regular Scripts, and ServerScriptService scripts?

I'm a bit new to scripting, and I really didn't learn the technical stuff. What is the difference between a LocalScript, and a regular Script? What does a script running in the "ServerScriptService" do differently than one running in the Workspace?

I just want a clear explanation of this kind of stuff, and as detailed as possible. Thanks!

2 answers

✓ Accepted answer

First of all, the ServerScriptService is the 'container' for pretty much all Scripts. When placed there, they will act just as if they were in the Workspace, directly, but with a different Parent. It's a good idea to put your Scripts in there whenever possible for both organizational purposes and a tiny bit of security - ServerScriptService doesn't replicate to any Client.

Now, LocalScripts are, well, Local. They run on the Client, whereas normal Scripts run on the Server. This lets you use certain Client-only things such as Camera Manipulation, custom Input Bindings and Mouse stuff. They also let you use the RenderStepped Event, which updates exactly at the framerate of the Client, allowing for perfectly smooth animations and whatnot.

Anything that requires an external connection, such as the MarketPlaceService and the various other services that allow interaction with the ROBLOX site, need to be in Scripts.

LocalScripts will only run in three places: the PlayerGui (in which I should mention Scripts will not run, if you have FilteringEnabled set to true), the Player's Backpack, and the Player's Character model. They do not have to be direct children, only descendants.

Scripts, on the other hand, will run as descendants of Workspace, nil (at least until garbage collected), again the Player's Backpack, and the ServerScriptService.

1 comment

0

Thanks!

I can't explain the ServerScriptService script.But i can do normal scripts and localscripts. Localscripts Localscripts will only run for one player. Normal scripts Normal script run for the whole server

This discussion is preserved as it was. New answers, comments, and votes are closed.