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

GUI will not come up after trying to fix it?

Asked by 10 years ago

Alright, so I posted something about a GUI not coming up yesterday I think. I got some great responses and it was fixed, sort of. It would show up then disappear right after. Here was that code:

local open = script.Parent
local box = open.Frame
local map = box.Map
local pic = box.Mapic

open.MouseButton1Down:connect(function(mouse)

        pic.Visible = true
    map.Visible = true
    box.Visible = true
    open.Text = "Close"
        if open.Text == "Close" and open.MouseButton1Down then
        open.Text = "Teleport Menu"
    pic.Visible = false
    map.Visible = false
    box.Visible = false
        end
end)

So I tried using Debounce because I had no clue how to fix this or anything. Well, now nothing happens again. No output errors. Here is the code now:

local open = script.Parent
local box = open.Frame
local map = box.Map
local pic = box.Mapic
local enabled = true


open.MouseButton1Down:connect(function(mouse)
    if not enabled then

        enabled = false
        pic.Visible = true
    map.Visible = true
    box.Visible = true
    open.Text = "Close"
    wait(1)
        if open.Text == "Close" and open.MouseButton1Down then
        open.Text = "Teleport Menu"
    pic.Visible = false
    map.Visible = false
    box.Visible = false
    enabled = true
        end
        end
end)

Some help please? xD

1 answer

Log in to vote
0
Answered by 10 years ago

MouseButton1Down is an event, not a bool value or property. Here, I fixed it.

local open = script.Parent
local box = open.Frame
local map = box.Map
local pic = box.Mapic

local Opened = false --If the gui is opened by default, change this to true
open.MouseButton1Down:connect(function() --"mouse" has nothing to do with MouseButton1Down
    if Opened == false then
        Opened = true
        pic.Visible = true
        map.Visible = true
        box.Visible = true
        open.Text = "Close"
    else
        Opened = false
        open.Text = "Teleport Menu"
        pic.Visible = false
        map.Visible = false
        box.Visible = false
    end
end)
Ad

Answer this question