Or would I have to go through and write
if (inputObject.KeyCode == Enum.KeyCode.W) then
--Code
end
for each one?
Or would I have to go through and write
if (inputObject.KeyCode == Enum.KeyCode.W) then
--Code
end
for each one?
You can print it out by implementing something like this :
if (inputObject.KeyCode == Enum.KeyCode.W) then
print("Key pressed!")
end
That is the most efficient way to detect player keys. Maybe you need to change the code so that it can function better.
perhaps you're looking for something like
local keys = "WASD"
if string.find(keys, (tostring(inputObject.KeyCode)):sub(14)) then
-- do stuff
end
This discussion is preserved as it was. New answers, comments, and votes are closed.