Build a Platform
Part of the Roblox Game Scripting section of Coddy's Lua journey. Lesson 4 of 24.
Scripts can build the world too. Instance.new makes a new object, and you set its properties before you put it in the game:
local ball = Instance.new("Part")
ball.Name = "Ball"
ball.Shape = Enum.PartType.Ball
ball.Position = Vector3.new(0, 20, 0)
ball.Parent = workspaceA new part is not in the world until its Parent is set to workspace. Setting Parent last means the part shows up already finished.
A new part is also not anchored: gravity pulls it down and it falls. The ball above drops from height 20 onto the ground. A part with Anchored = true stays exactly where you put it, which is what you want for floors, walls and platforms.
Challenge
EasyThis time there is no bridge at all. Your script runs in ServerScriptService and builds one.
Make a new Part that:
- is named
Platform - has the Size
6, 1, 28and the Position0, 10, 0 - does not fall
- is in the world
Press Play and cross it, then Check.
Try it yourself
local platform = Instance.new("Part")
-- 1. Name it Platform
-- 2. Size and Position
-- 3. Keep it from falling
-- 4. Put it in the world
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Roblox Game Scripting
2Loops and Functions
Row of PillarsStaircase BuilderTower BuilderCoin FactoryBlinking LightVanishing Bridge5Your First Game
Your First ObbyPractice on your own: Online Lua compiler