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

How can I make the title of a game disappear as well as the buttons to it?

Asked by 7 years ago
Edited 7 years ago

Ok. For detail, I'm creating a game that has a main menu. I have created 3 buttons (inside a frame) that are scripted. The buttons are NAMED PlayButton ,LoadoutButton , and StoreButton.(NOT TEXTED) I have successfully been able to script the PlayButton to where it makes all of the buttons disappear after 3 seconds. The Code of the PlayButton \/

script.Parent.Parent.Visible = true

script.Parent.MouseEnter:connect(function()
    script.Parent.BackgroundColor3 = BrickColor.Red().Color
end)

script.Parent.MouseLeave:connect(function()
    script.Parent.BackgroundColor3 = BrickColor.White().Color
end)

script.Parent.MouseButton1Click:connect(function()
    script.Parent.Text = "3"
    wait(1)
    script.Parent.Text = "2"
    wait(1)
    script.Parent.Text = "1"
    wait(1)
    script.Parent.Parent.Visible = false
end)

Now the problem is, I've made a textlabel in the screengui called "Title" saying the title of the game which is "Ace Force 6". How can I make it disappear like the buttons?

Also note that all of these buttons, titles, frames I have said are all in a screengui.

If you want to see the main menu personally, go to https://www.roblox.com/games/712700161/Ace-Force-6 *It doesn't seem to work if I put it in a link.

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

This is actually a pretty simple one. Let's say the parent of the text label is the frame, same as the buttons, and this script is inside the play button, as you already said.

The frame would be

script.parent.parent

and the text label could be changed by doing

script.Parent.Parent.textLabel.visible = false

I don't know what you named your text label so just change text label to the name of your text label and, if I'm understanding correctly, that should make it disappear.

I suggest, when doing something like this, making it a bit less confusing on you by simply just defining everything instead of having to call things like script.parent.parent.textLabel all the time.

--Defining works like this
playButton = script.Parent
--Now when you want to edit the playButton you can just do
playButton.Visible = true
--or
playbutton.Text = "Hi mom"
0
Thanks for the answer! I had to do script.Parent.Parent.Parent.Title.Visible = false for it to work. :D laserhawk123 4 — 7y
Ad

Answer this question