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

Making a Main Menu GUI Fade Out When Clicking a Play Button?

Asked by 7 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

Can someone help me out with this, because I have been searching for 5 hours trying to find a solution to no avail. I can provide a picture of the GUI if you absolutely NEED to see it to come up with an answer. Thank you to whoever answers this question.

0
Post the code you currently have please? I want to see where you're going wrong. Qweeble 5 — 7y

1 answer

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

Well, first off it seems to me that you don't have much knowledge when it comes to scripting, if any. So I'll just explain everything you need to know!

Read up on this Wiki Link if you don't understand Events

Assuming you have the script inside the "play" button it would look something like this

script.Parent.MouseButton1Down:connect()

That is an event; however, it doesn't quite do anything yet except look for when the player clicks the button, how about we make this do something?

This is assuming you know what Functions are. If not read about it here

script.Parent.MouseButton1Down:connect(function()
print("Did you just click me?")

end)

Now the script looks for when the player clicks the button and then fires the function we told it to fire.

This can be done in other ways such as this.

function onClick()
print("Did you just click me?")
end

script.Parent.MouseButton1Down:connect(onClick)

If you prefer to use that method you can, it's all preference in my opinion!

Now that you understand Events and Functions lets move on to manipulating the properties of a Frame, Textbox, TextLabel, etc. within a GUI.

For now, we'll stick with the properties of a Frame! You can read about such properties here!

The properties we'll be changing are transparency and visible

script.Parent.MouseButton1Down:connect(function()
print("Did you just click me?")
local frame = script.Parent.Parent -- Assuming the button is inside the frame

repeat wait(.2) frame.Transparency = frame.Transparency + .1 until frame.Transparency == 1
frame.Visible = false


end)

Learn about repeat and other loops here

That's pretty much the basics of it and I can only hope you grow off of this!

Ad

Answer this question