What im trying to do is take the TextButton and when you click it a textbox and the button disappears. my code is:
1 | game.Players [ p.name ] .PlayerGui.ScreenGui.Textbutton.MouseClick:connect( function (p) |
2 | game.Players [ p.name ] .PlayerGui.ScreenGui.TextButton.Visible = not game.StarterGui.ScreenGui.TextButton.Visible |
3 | game.Players [ p.name ] .PlayerGui.ScreenGui.TextBox.Visible = not game.StarterGui.ScreenGui.TextBox.Visible |
4 | end ) |
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
1 | game.Players [ p.name ] .PlayerGui.ScreenGui.TextButton.MouseButton 1 Click:connect( function () |
2 | game.Players [ p.name ] .PlayerGui.ScreenGui.TextButton.Visible = false |
3 | game.Players [ p.name ] .PlayerGui.ScreenGui.TextBox.Visible = false |
4 | end ) |
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.
1 | game.StarterGui.ScreenGui.TextButton.MouseButton 1 Click:connect( function () |
2 | game.StarterGui.ScreenGui.TextButton.Visible = false |
3 | game.StarterGui.ScreenGui.TextBox.Visible = true |
4 | end ) |
Please accept my answer if this worked for you, if not, please leave a comment and i will get back to you ASAP.