Remove UI when BoolValue is true

Hello, I’m trying to make a local script within the UI.

The UI should appear when the user walks into a zone. It should get automatically removed when a bool value is true (The player has activated all the crystals).

I receive the UI but it doesn’t get deleted.

Help would be appreciated.

Code: (In localscript within the UI in startergui) a. (Bool value is true)

function Touched()
	script.Parent.MainFrame.Visible = true
	if game.ReplicatedStorage.Cristals.ActivatedAll == true then
		script.Parent.Parent.Parent.Crystals:Destroy()
	end
end

game.Workspace.MiniGameCrystal.Crystals.UIHandler.Touched:Connect(Touched)
1 Like