Tool unequip script help

I want to implement the ability to switch tools whilst keeping the unable to unequip tool function, alongside making it so you equip the 1st tool in your backpack as soon as you join.

Can someone help with adding that? None of my methods worked & caused studio crashes, so here’s an older version of my script that doesn’t have my own attempts at doing that in it.

wait(1)
local tool = script.Parent
local player = game.Players.LocalPlayer
local hum = player.Character.Humanoid

tool.Equipped:connect(function(mouse)
	game:GetService("RunService").RenderStepped:connect(function()
		if not hum.Parent:FindFirstChild(tool.Name) then
			hum:EquipTool(tool)
		end
	end)
end)
1 Like

What exactly are you trying to do?

1 Like

all you would need to do is,

make an equipped variable for the other tool

then add an “if” statement to the tool.Equipped function you already have

i wrote this in the dev forum btw, might have a syntax error or something

wait(1)
local tool = script.Parent
local player = game.Players.LocalPlayer
local hum = player.Character.Humanoid
local Tool2Equipped
tool.Equipped:connect(function(mouse)
	game:GetService("RunService").RenderStepped:connect(function()
		if not hum.Parent:FindFirstChild(tool.Name) and Tool2Equipped == false then
			hum:EquipTool(tool)
		end
	end)
end)

tool2.Equipped:connect(function()
	Tool2Equipped = true
end)
tool2.Unequipped:connect(function()
       Tool2Equipped = false
end)
2 Likes

I want to make it so you can equip various tools in your inventory, but can’t unequip them.

1 Like

I could swap around tools, but I could unequip the one with this script…

1 Like

you have to define tool2, if you want to not be able to unequip tool2 then just copy and paste the same code from the tool.Equipped

2 Likes