Hi,
So I have an event relating to ScreenGui and when I’m destroying this ScreenGui the event is still working and i want to disconnect it if ScreenGui don’t exist but I don’t know how to detect it because when I’m printing the gui name it says it still exist even after I destroyed it
just do a simple
if player.PlayerGui:FindFirstChild("ScreenGui") then
player.PlayerGui.ScreenGui:Destroy()
1 Like
local event
event = something.Event:Connect(function()
if player.PlayerGui.ScreenGui then
-- code
else
event:Disconnect()
end
end
that’s what I needed thanks