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

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

Asked by 6 years ago

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)
0
You should add more context about what you want to do. Synxcious 2 — 6y

2 answers

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

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)
0
didn't work. roblozinko 15 — 6y
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. DemotedGnar 95 — 6y
Ad
Log in to vote
0
Answered by
Ap_inity 112
6 years ago

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.

0
didn't work... roblozinko 15 — 6y
0
You can't click on a TextBox or TextLabel as far as I know of. thesit123 509 — 6y

Answer this question