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

How can you press a TextButton and make it and a TextBox disappear?

What im trying to do is take the TextButton and when you click it a textbox and the button disappears. my code is:

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

1 comment

0

You should add more context about what you want to do.

2 answers

Hey, I fixed your code to make it disappear but you had a lot of errors. 1, Some things were named differently. 2, It seems you are calling this from server which is not recommended. 3, I don't think you understand how PlayerGui and StarterGui work. I would suggest reading this for additional support: http://wiki.roblox.com/index.php?title=The_Fundamentals_of_Scripting_with_GUIs

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

2 comments

0

didn't work.

0

You need to give more context, scripting helpers doesn't just write code for people especially when there is little to no context. Please check out that Wiki article, it should help.

You've written a little too much code. It's as easy as placing the script inside a localscript.

I've also re-written your script for it to work.

game.StarterGui.ScreenGui.TextButton.MouseButton1Click:connect(function()
    game.StarterGui.ScreenGui.TextButton.Visible = false
    game.StarterGui.ScreenGui.TextBox.Visible = true
end)

Please accept my answer if this worked for you, if not, please leave a comment and i will get back to you ASAP.

2 comments

0

didn't work...

0

You can't click on a TextBox or TextLabel as far as I know of.

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