Like if I hit r and f it would
print("You pressed R and F") -- Example
Like if I hit r and f it would
print("You pressed R and F") -- Example
I believe that you would simply need something to make sure that the user has both keys down before one is lifted. To do this, I would use KeyDown and KeyUp.
Note - Code is not tested.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
rPressed = false
fPressed = false
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "r" then
rPressed = true
if rPressed == true and fPressed == true then
print("You pressed R and F")
end
elseif key == "f" then
fPressed = true
if rPressed == true and fPressed == true then
print("You pressed R and F")
end
end
end)
mouse.KeyUp:connect(function(key)
key = key:lower()
if key == "r" then
rPressed = false
elseif key == "f" then
fPressed = false
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Make sure to put this code in a LocalScript as well.
I see a error in your code: Line 13; You are attempting to compare 'key' with 'f', but 'f' is not defined, so the script may error and say 'Line 13: Attempt to compare 'key' to 'f' (a nil value)'. :P Ya Silly Billy!
get rid of line 7 and 22 and put on any line that says 'if key == "q" then' or 'if key == "r" then' instead put 'if string.Lower(key) == "q" then' and 'if string.Lower(key) == "r" then' message me on ROBLOX for the full script.