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.
local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode = Enum.KeyCode.E then --code for playing the animation and knocking out the NPC end end)