Ok so, I use a ClickDetector on a part that enables and disables a GUI when clicked, but I would like it to be disabled when clicking away from the ClickDetector instead. There is my code:
local ClickD = script.Parent
function onClick(plr)
local GUI = plr.PlayerGui:WaitForChild('Loadout')
if GUI.Enabled == false then
GUI.Enabled = true
else if GUI.Enabled == true then
GUI.Enabled = false
end
end
end
ClickD.MouseClick:Connect(onClick)
Any help is appreciated, because I couldn't figure this out. I'm also new to coding and I am willing to learn new things.

2 comments
Thank you very much!
Cheers!