Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

GUI Remover Script?

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)

http://prntscr.com/5z1ete

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.