My second destructor doesn't destruct.. If find out why can please tell me how to fix it.. Thanks in advance..

--if _ Keydown delete and create new Gui 
game:GetService("UserInputService").InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.Tab then
    print 'the key Tab has been pressed'
    local Gui = game.Players.LocalPlayer.PlayerGui:FindFirstChild("One")
    if Gui then
    Gui:Destroy()
    end
end
end)
------------------------------------------------------------------------------------
game:GetService("UserInputService").InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.Tab then
	player = game.Players.LocalPlayer
	gui = game.Lighting.Two
	gui:Clone().Parent = player.PlayerGui
end
end)
----------------------------------SECOND DECONSTRUCTOR-------------------------------------------------- 
game:GetService("UserInputService").InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.Tab then
	local GuiTwo = game.Players.LocalPlayer.PlayerGui:FindFirstChild("Two")
	if GuiTwo then 
	GuiTwo:Destroy()
	end 
end
end)

1 comment

0

Stop spamming this question. If you make changes, edit the current question, then notify the involved people about your changes. I also answered one of your questions.