The Status Board
Lesson 2 of 20 in Coddy's Roblox Game: Disaster Survival course.
Players in the lobby need to know what happens next. The big dark part there, workspace.StatusBoard, will show it.
Text on a part is a SurfaceGui holding GUI objects such as a TextLabel. A SurfaceGui inside a part draws on one face, the Front face unless you change its Face. The board has been turned so its Front faces the lobby.
local gui = Instance.new("SurfaceGui")
gui.Parent = workspace.StatusBoard
local status = Instance.new("TextLabel")
status.Size = UDim2.fromScale(0.5, 1)
status.Text = "Hello!"
status.TextScaled = true
status.Parent = guiA GUI size is a UDim2: a fraction of the parent (Scale) plus pixels (Offset) on each axis. UDim2.fromScale(0.5, 1) is half the parent's width and all its height; UDim2.fromScale(1, 1) would cover the whole board. TextScaled makes the text as large as fits.
Challenge
EasyPut a welcome message on the lobby's status board.
- Below the PlayerAdded code, make a SurfaceGui and parent it to
workspace.StatusBoard. - In it, make
local status = Instance.new("TextLabel")namedStatus, sizedUDim2.fromScale(1, 1). - Give it white text,
Color3.fromRGB(255, 255, 255), withTextScaledon, readingWelcome to Disaster Survival!
Press Play: the board in the lobby welcomes you in big white letters. Then Check.
Try it yourself
local Players = game:GetService("Players")
local Settings = require(game.ReplicatedStorage.Settings)
print("Rounds last " .. Settings.RoundLength .. " seconds")
-- Every player gets Wins on the leaderboard
Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local wins = Instance.new("IntValue")
wins.Name = "Wins"
wins.Parent = leaderstats
end)
-- Lesson 2: The Status Board goes here
All lessons in Roblox Game: Disaster Survival
Practice on your own: Roblox playground