literally the title
for index,value in Array do -- iterates through array
if Input.KeyCode = value then -- if Input is the iterated value
-- code
end -- end of if statement
end -- end of for loop
use task.spawn()
to prevent yielding.
If you are asking how to check if they pressed a key, use UserInputService
https://create.roblox.com/docs/reference/engine/classes/UserInputService
Have you show us what you have tried?
I guess table its something like this
keybinds = {
“E”;
“R”;
etc…
}
Then I guess just:
userInputService.InputBegan:Connect(function(input)
for _,v in pairs(keybinds) do
if input.KeyCode = Enum.KeyCode[v] then -- fixed not "Enum.KeyCode.v"
-- code
end
end)
end)
don’t tested can be wrong
if input.KeyCode = Enum.KeyCode[v] then
Here is a fix.
Thanks a lot! i have been trying for 5 hours!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.