I apologize if there's a rule about posting too much, this is only my second post but yeah. So i recently learned how to make a Gui and i made a simple one for now just so i know for the future the basics of making one. And i tested it in Roblox Studio test and it work's flawlessly. But then i tried it in game and it didn't work? Maybe someone knows why? Not sure if it's my script. But here's my script. Super weird that it's not working.
local button = script.Parent
local frame = script.Parent.Parent.Frame
button.MouseButton1Click:connect(function()
if button.Text == "BackPack" then
frame.Visible = true
button.Text = "Close"
elseif button.Text == "Close" then
frame.Visible = false
button.Text = "BackPack"
end
end)
Hopefully someone can help me figure out my problem. Not sure why the script isn't showing up on here i tried it like 5 different ways. Anyways heres a picture of the script http://imgur.com/6r9l2du

3 comments
Try "MouseButton1Down"
Add a "wait()" in the beginning, maybe you're not giving the script enough time to load.
Adding a wait worked thank you!