I am working on a system where if you sneak up behind an NPC (and get close enough) pressing E will allow you to knock them out. I've made all the animations but I can't find a good script that will allow me to make something like this. It's vital for the stealth features of my game to function properly. Any help is greatly appreciated.
1 | local UserInputService = game:GetService( "UserInputService" ) |
2 |
3 | UserInputService.InputBegan:Connect( function (input, gameProcessed) |
4 | if input.KeyCode = Enum.KeyCode.E then |
5 | --code for playing the animation and knocking out the NPC |
6 | end |
7 | end ) |