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

How to Make A key Down Function Script?

Example:If Key:"q" Does something.How do you do that please Help!

1 comment

0

Next time, please SEARCH THIS if someone else had this issue solved already, THEN make a new question if you didn't get any luck, or your reputation will fall badly.

2 answers

✓ Accepted answer

the script would look like this


mouse = game.Players.LocalPlayer:GetMouse()
function onKeyDown(key)
if key == "r" then
	--code goes here
end
mouse.KeyDown:connect(onKeyDown)

1 comment

0

Thanks

I usually use this:

game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
	if string.lower(key) ==  "q" then
		--do stuff
	end
end)

You need to put it in a local script.

1 comment

0

thanks

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