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

How do i make a close button for a brick gui close with filteringeneabled on?

Asked by 6 years ago

So im making a ClickDetector brick so when you click it the gui pops up its just that the close button doesn't work with FE. the code is

function onClick(click)
for i,v in pairs (script.Parent:GetChildren()) do
    if v.ClassName == "ScreenGui" then
    c = v:Clone()
    c.Parent = click.PlayerGui
    end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
1
I don't see any code here that seems to handle closing a gui WillieTehWierdo200 966 — 6y
0
Its for a part so the gui in it has the close in it and the close gui closes it. awesomwkidd 11 — 6y
0
all you've shown is the gui being cloned into the playergui...did you write anything other than this that is an actual close function for the gui? Vulkarin 581 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

This answer is going off this image: [(http://twitter.com/ZARAX211/status/949489738481795072)]

function onClick(click)
for i,v in pairs (script.Parent:GetChildren()) do
    if v.ClassName == "ScreenGui" then
    c = v:Clone()
    c.Parent = click.PlayerGui
    if c:FindFirstChild("Frame") then
        c.Frame.Close.MouseButton1Click:connect(function()
    c:Destroy()
    end)
    end
    end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)

Ad

Answer this question