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

Problem with GUIs turning visible and/or not. ?

Asked by 6 years ago

I tried to make it so whenever you press a button, some pictures appear and the shop button disappear. The shop button does disappear, but the pictures (and text buttons) WILL NOT APPEAR! This is very annoying, can someone tell me whats wrong with the script?

local a = 0
local b = script.Parent.ExtraObby
local c = script.Parent.ExtraStages
local d = script.Parent.MoreSoon
local e = script.Parent.Sword
local f = script.Parent.VIP
local g = script.Parent["skip stage"]
local h = script.Parent.tips
local i = script.Parent
script.Parent.MouseButton1Click:connect(function()
    a = a + 1
    if a == 1 then
        b.Visible = true
        c.Visible = true
        d.Visible = true
        e.Visible = true
        f.Visible = true
        g.Visible = true
        h.Visible = true
        i.Visible = false
    end
    if a == 2 then
        b.Visible = false
        c.Visible = false
        d.Visible = false
        e.Visible = false
        f.Visible = false
        g.Visible = false
        h.Visible = false
        i.Visible = true
        a = 0
    end
end)



while wait(2) do
    print("a is equal to " .. a .."!")
end

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

The lettered variables are inside your button. Children will follow the Visible aspect of its parent. Aka, when you make the button invisible, it'll automatically make all its children hide as well. Put all your buttons/pictures (except for the shop button) in a seperate frame, then control (visible not visible) the frame instead.

0
oh yeah haha thanks 0HappyManDudeguy0 15 — 6y
Ad

Answer this question