Scripting Activity

1. Hello World

In Roblox Studio, open a Baseplate.

ServerScriptService

In Explorer, click on ServerScriptService. Scripts will run inside this service, and will not replicate to game clients, allowing for secure storage of your scripts. In other words, they will run on Roblox's servers.

Add a Script

When you click on the + button, select Script.

A Script is a type of Lua code container that will run its contents on the server. By default, Scripts have print("Hello, world") as their contents.

Save to File

Click on File and Save to File

Output Window

In View, click on Output

Play Button

In Script Menu, click on Play

If all goes well, you should see Hello World in the Output window at the bottom of your screen.

Stop

Make sure you click on Stop (on the right) before editing your game further.

2. Insert a Part

Pick a Part, any part.

Rename the Part to MyPart or another intuitive name.

Add a Script to MyPart.

Let's change the properties of our Part via Lua.

Create a local variable named mypart to store Workspace MyPart

-- Create a variable to store the part
local mypart = game.Workspace.MyPart

Change the brick to a random color.

-- Changes the color of loopingPart every few seconds
-- Create a variable to store the part
local mypart = game.Workspace.MyPart
mypart.BrickColor = BrickColor.Random()

For your reference, here are a list of different possible colors:

3. Wait Function

To make the script wait before running the next line of code, use a wait() function.

wait(3) -- waits 3 seconds

Change your part to random colors.

-- Changes the color of loopingPart every few seconds
-- Create a variable to store the part
local mypart = game.Workspace.MyPart
while true do
--
wait(3)
end

4. Spawn Location

Add a Spawn Location or multiple Spawn Locations to your game. It's the icon under Effects.

5. Touched

Use the Touched Event to change the color of your Part when a Humanoid comes into contact with it.

6. Surface Guis

Using surface GUIs, you can add interfaces directly into your game world to create shop signs, keypad panels for locked doors, or even touch screens.