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

How would I make a space bar thing like mousebutton1down but with space?

I'm trying to make a frame visible when you press space bar

1 comment

0

Admin I can't see the note you gave me.

1 answer

✓ Accepted answer

UserInputService may help you with that. UserInputService just allows you to use other keys on the keyboard, and you can use stuff like F4, F5, etc. Put this script in StarterPlayerScripts, and make it a LocalScript. (I'll be using --comments to explain stuff.):

local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local plrGui = player.PlayerGui --This gets the Gui, assuming you're using StarterGui.

UIS.InputBegan:Connect(function(input, GPE) --This event will fire, whenever input is pressed. GPE means Game Processed event.
	if GPE then return end --If someone is chatting, then do nothing
	if input.KeyCode = Enum.KeyCode.Space then --If the input is space then
		plrGui.ScreenGui.Frame.Visible = not plrGui.ScreenGui.Frame.Visible --If it's not visible, then it's visible, and vice versa.
	end
end)

1 comment

0

stonks

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