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

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

Asked by 7 years ago

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

Log in to vote
0
Answered by
oSyM8V3N 429 Moderation Voter
7 years ago
Edited 7 years ago

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)
0
you need to to conect function abnotaddable 920 — 7y
0
you mean "function" Rawblocky 217 — 7y
0
script.Parent.MouseButton1Click:connect(function() KFCPhoeyu 41 — 7y
0
Oh my bad, i fixed it oSyM8V3N 429 — 7y
Ad
Log in to vote
1
Answered by 7 years ago
script.Parent.MouseButton1Click:connect(function()
    script.Parent.Visible = false
end)

local script inside the button

Answer this question