๐Ÿ“˜ Roblox Studio Part 3: Understanding Scripts

1. ๐Ÿงพ What is a Script?

A Script is a Lua file that runs on the server. It can control parts, detect player actions, give tools, and more โ€” but it doesnโ€™t run on the client side.

Example:

print("Server started")
workspace.Part.BrickColor = BrickColor.new("Bright red")

๐Ÿ“Œ Place Scripts in: ServerScriptService, Workspace, or Tools.

2. ๐Ÿง What is a LocalScript?

A LocalScript runs on the playerโ€™s device (client). It is used to control UI, camera, mouse, and local input.

Example:

script.Parent.Text = "Hello " .. game.Players.LocalPlayer.Name

๐Ÿ“Œ Place LocalScripts in: StarterGui, StarterPlayerScripts, StarterPack, Character.

3. ๐Ÿ“ฆ What is a ModuleScript?

A ModuleScript contains reusable functions or data and can be required by Scripts or LocalScripts.

Example:

-- ModuleScript
local module = {}
function module.sayHi()
  print("Hi from module!")
end
return module
-- Script or LocalScript
local myModule = require(game.ServerScriptService.MyModule)
myModule.sayHi()

๐Ÿง  Quiz: Script Types in Roblox