Get it? It's like when you hold down a button and press another button, it triggers something.
And also, how to make the script knows that the player has stopped pressing those keys?
Get it? It's like when you hold down a button and press another button, it triggers something.
And also, how to make the script knows that the player has stopped pressing those keys?
Hello,
local ui = game:GetService("UserInputService") -- Get the UserInputService.
ui.InputBegan:Connect(function(input,gpe)
if not gpe then -- If not on a gui.
if ui:IsKeyDown(Enum.KeyCode.Space) and ui:IsKeyDown(Enum.KeyCode.W) then -- If Space AND W are being held down/ pressed at the same time, it will trigger the event you want.(In this case print)
print("~Stuff here~")
end
end
end)
Reference here for the IsKeyDown() function.
You can also check KeyCodes here
If you have any question feel free to ask.
Thank you for reading.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
This was really helpful !
@arshad145 And how to know if the player has stopped pressing those buttons?