Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
2
Answered by
Nanomatics 1160 Moderation Voter
4 years ago

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!

0
What if the local script isn't in a player, but in the workspace or something? zandefear4 90 — 4y
1
If it is in the workspace then it won't work basically Nanomatics 1160 — 4y
0
Ok, thanks! zandefear4 90 — 4y
0
If I want to add a gui for all players, how would I do that? Would I have to use a remote event? zandefear4 90 — 4y
View all comments (4 more)
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 Nanomatics 1160 — 4y
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. zandefear4 90 — 4y
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 Nanomatics 1160 — 4y
0
Well Explained @Nanomatics! <:D>! Tizzel40 243 — 4y
Ad

Answer this question