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

What are all the differences between local scripts and normal scripts?

I kinda know some of the differences, like scripts and for the server and local scripts are for the client. But are there more differences?

1 answer

✓ Accepted answer

I'll try to give a brief explanation of each:

A LocalScript is a script that is used to control what happens on the client side, basically what the person in front of the screen sees individually, it does not show for all other people playing the game in the same server.

Let us say for example a player walks to a shop, you want the shop to show for that player and just that player, nobody else. Anything that is modified by a localscript in a FilteringEnabled on place does not affect the server.

Another example could be if you create a part and place it in workspace through a specific player's localscript, that part is only visible to that player, not anybody else.

Now a ServerScript is a script that controls the server side, which is seen by all the people in the current server, so lets say a car is spawned, you wouldn't choose to do that locally because then you'd see a character floating around the map. For all players to see the car, it has to be spawned by a serverscript.

In simple words, think of serverscripts as the real world outside our houses, we see the buildings, roads, mountains, etc, this is a serverscript. However we do not see what is inside a house, that is being witnessed by someone else who lives in that house (person behind the screen), this is a localscript.

Hope my explanation helped you understand a bit better, please let me know if you have any questions!

8 comments

0

What if the local script isn't in a player, but in the workspace or something?

1

If it is in the workspace then it won't work basically

0

Ok, thanks!

0

If I want to add a gui for all players, how would I do that? Would I have to use a remote event?

1

Well if its a gui for all players that is going to be there since the beginning of the game, then you just put it in StarterGui, if not then just clone that startergui into every player's PlayerGui through a serverscript

0

Yeah, but how do I put it in the players gui with a server script? I cant use local player, like a local script. I would also be adding it.

1

You just need to iterate through all the players in the game, and then refer to the ScreenGui u want to show to show the player, clone it and parent it to Player.PlayerGui

0

Well Explained @Nanomatics! <:D>!

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