I am creating a shooter and I want to prohibit the removal of weapons from my hands, but only switch between them, an rifle, a gun and a knife. I am poorly versed in scripts and do not understand how to do this, so I will be very grateful to the person who will help me.
If the gun or weapon is a tool you can go to properties and click on CanBeDropped.
Or you could use something like this in a local script:
game.Players.LocalPlayer.Backpack.Rifle.CanBeDropped = false
In addition to the previous answer, You could also just configure this in the properties tab. Here’s a link with more about tool.CanBeDropped
https://developer.roblox.com/en-us/api-reference/property/Tool/CanBeDropped