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

Open/Close code won't work with chat button, can you help me? [Custom gui]

Asked by
vkax 85
5 years ago

Ok, so, I'm trying to make a chat button on the topbar but the visible code won't work, I need help

local ChatButton = script.Parent.Bar:WaitForChild("Chat")
local ChatTarget = script.Parent.Parent.Parent.Chat.Frame

ChatButton.MouseButton1Click:connect(function()
    if ChatTarget.Visible then
        ChatTarget.Visible=false
    else
        ChatTarget.Visible=true
    end
end)
0
Are you getting any errors in the output box? If you are, could you type them here? Also, instead of using "connect" in line 4, use "Connect" instead. "connect" is deprecated and ROBLOX might delete it soon, so make sure you capitalize the "c". lunatic5 409 — 5y
0
Also, what's the point of the "if" statement on line 5? What is this checking for exactly? Is it checking for "Visible" as in the property? Because I am unsure if you can use an "if" statement to check if a property exists. If this is what you are trying to use it for, I don't think there is a reason for it anyway. Did you maybe mean to type "if ChatTarget.Visible == true then"? lunatic5 409 — 5y
0
I have a similar code in GUI but FE broke it OBenjOne 190 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I don’t know why it doesn’t work. It should.

ChatButton.MouseButton1Click:Connect(function()
    ChatTarget.Visible = not ChatTarget.Visible
    print"Gui toggled!" --Add a print to make sure its working. 
end)
Ad

Answer this question