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

How to Make A key Down Function Script?

Asked by 11 years ago

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

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. Nickoakz 231 — 11y

2 answers

Log in to vote
0
Answered by
Damo999 182
11 years ago

the script would look like this

1mouse = game.Players.LocalPlayer:GetMouse()
2function onKeyDown(key)
3if key == "r" then
4    --code goes here
5end
6mouse.KeyDown:connect(onKeyDown)
0
Thanks FPSStudioDidi 1 — 11y
Ad
Log in to vote
3
Answered by
Mr1Vgy 30
11 years ago

I usually use this:

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

You need to put it in a local script.

0
thanks FPSStudioDidi 1 — 11y

Answer this question