Disable keyboard and mouse buttons

Hi guys, I wanted to know how I could make the keyboard buttons and mouse clicking disable when the user dies.

I’m making a gun game and the guns disappear and the deathscreen comes up when you die but the problem is when you are dead you can still change between weapons by pressing 1 or 2. How can I disable the keyboard and mouse buttons so they can’t do anything while they are dead?

Thanks :smiley:

Not quite sure you can do that, but as an alternative I would suggest disabling the player’s backpack. It will prevent them from equipping tools or viewing their backpack.

-- from a LocalScript
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

Just make sure that you set it back to true once the player character respawns.

Custom made hands and guns aren’t tools. They are just models in the camera with scripts

Then remove these objects on death, there’s no way to un bind the main actions, unless you fork the player module

I’ll try to disable it so he can’t access the second tool. The tool that is being used gets removed but he still can change to the other one so I might try and making it so he can’t change.