Scripting 101: Functions (Part 2) | Roblox Studio | 2022

2 years ago
30

In this Roblox development video I go over return values for functions. Additionally, I introduce the for loop. Since this is a continuation of the last video, I provide the script below from "Functions (Part 1)". Copy it, create a "script" in your workspace, and you will have everything you need.

------------ Steps --------------------------------
local function makeStep(y, z)
wait(.2)
local part = Instance.new("Part", workspace)
part.Position = Vector3.new(0, y, z)
part.Size = Vector3.new(10, .5, 3)
part.Anchored = true
part.TopSurface = Enum.SurfaceType.Smooth
part.BottomSurface = Enum.SurfaceType.Smooth
part.BrickColor = BrickColor.Random()
end

wait(6)
makeStep(2, 3)
makeStep(4, 6)
makeStep(6, 9)
makeStep(8, 12)

Loading comments...