Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to prevent the removal of tools from my hands, but at the same time I could switch between them?

Asked by 3 years ago
Edited 3 years ago

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.

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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
Ad
Log in to vote
0
Answered by 3 years ago

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

Answer this question