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

.Keydown not activating?

I feel really, really, really, REALLY... Stupid for asking this question, I forgot how to use .Keydown, have not used it in a while.. Here's what I have.

game.Players.LocalPlayer.KeyDown:connect(function(mouse)
	if mouse == "o" then
		if script.Parent.Command.Visible == true then
			script.Parent.Command.Visible = false
		end
	else
		script.Parent.Command.Visible = false
	end
end)

1 comment

0

Just long time I feel stupid * sigh *

1 answer

✓ Accepted answer

You need to declare the mouse:

local mouse = game.Players.LocalPlayer:GetMouse() -- !!!!!

mouse.KeyDown:connect(function(key)
	key = key:lower() -- make sure you make it lowercase for the 'if' to work!
	if key == "o" then
		-- code
	end
end)

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