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

When should you use a LocalScript and when should you use a Script? [closed]

Asked by
Ozzypig 185
10 years ago

I have a script that is meant for a GUI that displays the value of a StringValue in the workspace, but I don't know if I should use a LocalScript or Script.

1
I don’t think this should be tagged with efficiency. Efficiency doesn’t seem very relevant to me. MarkOtaris 241 — 10y

Locked by ConnorVIII, adark, 1waffle1, and Thewsomeguy

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
2
Answered by 10 years ago

You should always use local scripts for tasks related to user input, including everything related to mouse or keyboard input as well as user interfaces and camera manipulation. Tasks directly dependent on user input (including actions performed by tools in result to user input) should also be done with local scripts. For everything else, scripts that run on the server should be used. The server and the clients can communicate using the RemoteFunction and RemoteEvent objects.

2
Also note that local scripts can be modified by the client Quenty 226 — 10y
2
That can be a big security hazard in some games. Quenty 226 — 10y
1
Thanks for filtering enabled now ^.^ http://wiki.roblox.com/index.php?title=FilteringEnabled_(Property) Nickoakz 231 — 10y
Ad
Log in to vote
1
Answered by
Unclear 1776 Moderation Voter
10 years ago

You should use a LocalScript if you plan on using the features that LocalScripts give you.

But, if you're afraid of the StringValue in workspace being edited for some reason by the client (exploiter?), you can always hide it by putting it in ServerStorage instead. Then, you would use a regular Script to access it.

However, if the script is only doing a small task like that, I would probably trust the client to handle it and have the code execute through a LocalScript.

Log in to vote
-3
Answered by 10 years ago

Use local scripts if you want it to be apart of for example something in the StarterPack to customize that object. Its used for 1 thing only. And you can use the regular script if your using it for a simple part. Like changing the appearance or an event. So local script and regular script are kinda alike.