Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with my title screen script?

Asked by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

The actual title screen is working, but I'm unsure how to make it close. I can see by comparing to other scripts that the end isn't right at all, but I don't know how to fix it.

Also, how do I set the Text color in TextColor3? I've researched, but I don't quite get it. Thanks in advance!

The script:

local titlescreen = Instance.new("ScreenGui")
titlescreen.Parent = script.Parent

-- Frame
local titleframe = Instance.new("Frame")
titleframe.Parent = titlescreen
titleframe.Position = UDim2.new(0, 75, 0, 75)
titleframe.Size = UDim2.new(0, 850, 0, 400)
titleframe.Style = "RobloxRound"

-- Text
local titletext = Instance.new("TextLabel")
titletext.Parent = titlescreen
titletext.Position = UDim2.new(0, 400, 0, 85)
titletext.Size = UDim2.new(0, 250, 0, 50)
titletext.FontSize = "Size24"
titletext.BackgroundTransparency = 1
titletext.Text = "Project Undefined"

-- Button
local titlebutton = Instance.new("TextButton")
titlebutton.Parent = titlescreen
titlebutton.Position = UDim2.new(0, 400, 0, 175)
titlebutton.Size = UDim2.new(0, 250, 0, 50)
titlebutton.FontSize = "Size14"
titlebutton.Text = "Start"

function close()
    titlescreen.Visible = false
    titlebutton.Visible = false
    titletext.Visible = false
end

titlebutton.MouseButton1Click:connect(close)

1 answer

Log in to vote
0
Answered by 8 years ago

To easily close a Gui, just delete the ScreenGui, like so:

titlescreen:remove()

TextColor3 is a Color3 value. Color3 values go like this:

Color3.new(R,G,B)

RGB stands for Red, Green and Blue. Each number goes from 0 (being nothing, black if everything is 0), and 255 (white if everything is 255). I don't know why they made it RGB, instead of RYB (red, yellow, blue), so please don't ask xD

0
Nevermind, the color thing worked. Pyrondon 2089 — 8y
Ad

Answer this question