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 10 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 — 10y

2 answers

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

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)
0
Thanks FPSStudioDidi 1 — 10y
Ad
Log in to vote
3
Answered by
Mr1Vgy 30
10 years ago

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.

0
thanks FPSStudioDidi 1 — 10y

Answer this question