Hi helpers, This question has to do with my previous one. I made a UI with a close button, and a function for the close button but I do not know how to script the close button without the variable in the Clicked function.
local C1 = script.Parent.Parent.Chassis.ClickDetector
local C2 = script.Parent.Parent.LTrack.ClickDetector
local C3 = script.Parent.Parent.RTrack.ClickDetector
local C4 = script.Parent.Parent.Turret.ClickDetector
function Clicked(playerWhoClicked)
local UI = game.ServerStorage.UnitUI:clone()
UI.Parent = playerWhoClicked.PlayerGui
end
function Close()
local XButton = UI.Background.Close
UI:Destroy()
end
C1.MouseClick:connect(Clicked)
XButton.MouseButton1Down:connect(Close)
Ignore the C2, C3, and C4.
A response would be appreciated!

1 comment
Toggle the visibility of the UI