KeyDown is deprecated, consider moving to UIS
1 | local player = game.Players.LocalPlayer |
2 | local UIS = game:GetService( "UserInputService" ); |
4 | UIS.InputBegan:connect( function (input,proc) |
5 | if proc and input.KeyCode = = Enum.KeyCode.E then |
6 | (player.Character or player.CharacterAdded:wait()):BreakJoints(wait()) |
Take a look at these
* UserInputService
* InputBegan
If you're curious about where I've written
1 | (player.Character or player.CharacterAdded:wait()):BreakJoints(wait()) |
it simply makes sure that the Character exists, and then wait()s for it to load before killing it evilly.