I have received help earlier but I'm not on with coding.. I'm basically making it If I press Z it'll delete a Gui I make appear in a different script. When I press Z in game nothing happens? Much appreciated if helped
pcall(game:GetService("UserInputService").InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.Z then
print 'the key Z has been pressed'
local Gui = game.Players.LocalPlayer.PlayerGui:FindFirstChild(One)
if Gui then Gui:Destroy() end
else
print 'Y u no press Z?'
end
end))

7 comments
Why have you put this in a pcall?
Because I when I press Z I want to destroy the gui
You dont need a pcall for that
What do you mean?
remove the pcall
Still doesn't work?
Remove the pcall. Is this a Server Script, if so it will not take UserInput.