Hello. I am trying to have something set to where You press the space bar and the GUI goes away. But when I test it out on studio and press space bar it does nothing. Help?
function onkey(key) if key == " " then local frame = script.Parent frame.Visible = false --making the frame and everything inside invisible --I don't know how to make it fade, sorry! end end script.Parent.KeyDown:connect(onkey)
Try using this in a local script and place in the starterpack or startergui areas.
wait(.5) local player = game.Players.LocalPlayer local mouse = player:GetMouse() local frame == nil -- Place the location of it here, example: player.PlayerGui.ScreenGui.Frame mouse.KeyDown:connect(function (key) if key:byte() == 32 then frame.Visible = false end end)