Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

GUI Remover Script?

Asked by 10 years ago

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

Log in to vote
1
Answered by 10 years ago

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)
Ad

Answer this question