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

How do I make it where the player can't unequip a tool?

Asked by 4 years ago

Am I able to make it where the player can't put the tool in their Backpack so it stays equipped?

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

The short answer is that it's not possible to disable the unequip potential of a tool instance.

However, there are workarounds, two in particular:

1) Re-equip the tool every time it's unequipped

2) Don't use a tool instance - create your own system

Method 1 is simple enough:

-- LocalScript under the tool
local player = game.Players.LocalPlayer
local tool = script.Parent

tool.Unequipped:Connect(function()
    game:GetService("RunService").Stepped:Wait()
    player.Character.Humanoid:EquipTool(tool)
end)

However, because of the RunService.Stepped:Wait(), the tool will disappear for approx. a frame, and it's pretty visible. The wait is necessary though, as without it the script would be trying to set the tool's parent to two places simultaneously, and the script won't allow it.

Method 2 is to just ditch the tool instance, and create a custom tool by welding it to the character and setting up the necessary functions (such as equip). I won't go through it all because it's a longer process, but not as daunting as it might seem at first. This is the better solution if you want to put more time into it, as there won't be the same visible blip as with method 1.

0
can you make it in a way that you can switch tools without equiping the previous tool? coolkid900043 0 — 3y
Ad
Log in to vote
0
Answered by 4 years ago

just make a script that re-equips it every time it is unequipped!

1
You're not even gonna show them how to do it? marioman1932 48 — 4y

Answer this question