Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

3 comments

1

I don't see any code here that seems to handle closing a gui

0

Its for a part so the gui in it has the close in it and the close gui closes it.

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?

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.