Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make a button disappear when i click it?

What i want to do is when i click a button a TextBox and the button's visibility to false, but when i click the button, nothing happens. My code:

game.StarterGui.ScreenGui.TextButton.MouseButton1Click:connect(function(p)
    game.Players[p.name].PlayerGui.ScreenGui.TextButton.Visible = false
    game.Players[p.name].PlayerGui.ScreenGui.TextBox.Visible = false
end)

2 answers

✓ Accepted answer

Put this in a localscript inside the button you want the player to click, then here's an example of how to make it so when clicked the visibility is false

script.Parent.MouseButton1Click:connect(function()
script.Parent.Visible = false
--if the textbox is somewhere else you could use the same thing, but change the location
--for ex: script.Parent.Parent.Visible = false
end)

4 comments

0

you need to to conect function

0

you mean "function"

0

script.Parent.MouseButton1Click:connect(function()

0

Oh my bad, i fixed it

script.Parent.MouseButton1Click:connect(function()
	script.Parent.Visible = false
end)

local script inside the button

This discussion is preserved as it was. New answers, comments, and votes are closed.