Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 answers

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.

1 comment

0

can you make it in a way that you can switch tools without equiping the previous tool?

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

1 comment

1

You're not even gonna show them how to do it?

This discussion is preserved as it was. New answers, comments, and votes are closed.