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

Can someone please tell me the difference between a Script, LocalScript, and ModuleScript?

2 answers

Local script: "A LocalScript is a Lua source container that runs Lua code on a client connected to a W server." - Roblox Wiki

Module script: "A ModuleScript is a Script-like object that contains code for a module." - Roblox Wiki

Normal Script: "A Script in ROBLOX is a type of object that holds a section of Lua code. A script will execute on the server and has access only to server-side events and properties." - Roblox Wiki

2 comments

0

You should research into Robloxs' Wiki time to time.

0

Heads up! If you learn to code in other languages, you will need a more detailed explanation of threads, environments, and other stuff that makes the differences between these scripts HUGE.

Since the other answer did not do a great job I'll try to be as vague as possible

LocalScripts can only run on the client side, meaning they can't urn in workspace unless they're inside of the character

Scripts can be run on any Server managed area. This means it's mostly used for server-side interaction, but cannot use things like game.Players.LocalPlayer

ModuleScripts are scripts that do not autorun, so at the end of the script you have to return something that can be called

Example

Inside the module script

local thing = 3

return thing

Inside the Script or LocalScript

local module = require(Place where the module is located)

print(moduld) -- prints 3

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