Hello! So, I'm no scripter at all, but I know a few basics. I'm trying to make a stats Gui for my place. Here's a Gyazo of the Guis I'm working with here, so it doesn't confuse you. http://gyazo.com/387a1534107ac3a84f1f4e4907d5f202
The only problem is, it's not working. I don't know how to script much, but I thought I would try working with Guis. Obviously, it was a mistake. Here's the code I wrote out.
Oh, and the Value type I'm using is a NumberValue, "0" representing that the Stats Gui is currently closed, "1" representing that it is currently open.
function onClicked() open = script.Parent.Open if open.Value == "1" then script.Parent.Parent.Stats.Visible = false script.Parent.Text = "Open Stats" else open.Value = "1" script.Parent.Parent.Stats.Visible = true script.Parent.Text = "Close Stats" end end game.StarterGui.ScreenGui.TextButton.Clicked:Connect(onClicked)
I need help fixing it, I don't know what's wrong. Try not to rewrite the whole thing, and explain as much as you can so I can understand what I did wrong.
Thanks!
Alright. So here is the script, an explanation is in the PM.
function onClicked() open = script.Parent.Open if open.Value == "1" then open.Value=0 script.Parent.Parent.Stats.Visible = false script.Parent.Text = "Open Stats" else open.Value = "1" script.Parent.Parent.Stats.Visible = true script.Parent.Text = "Close Stats" end end game.StarterGui.ScreenGui.TextButton.MouseButton1Down:connect(onClicked)
I tried both, but neither worked. If you want you can rewrite the code and give me instructions on what to do. I'm not sure what's wrong.
Well, I commented on the variable. Also, you didn't have it change the value for lines 3 through 5. Sorry if I may have re-writed it.
pen = script.Parent.Open.Value -- I recomend this being a bool value. game.StarterGui.ScreenGui.TextButton.Clicked:connect(function() if not open then open = true script.Parent.Parent.Stats.Visible = true script.Parent.Text = "Close Stats" else open = false script.Parent.Parent.Stats.Visible = false script.Parent.Text = "Open Stats" end end)