How would I make when a player equips a tool it doesn't go back to their inventory?

  1. **What do you want to achieve?
    I made a custom inventory system but I wanted that when the player unequips a tool, it doesn’t change the parent to backpack
  2. **What is the issue?
    I don’t know how
  3. **What solutions have you tried so far?
    I tried deleting it from a server side
Events.Equip.OnServerEvent:Connect(function(Player, bind)
	for i, v in pairs(Player.Character:GetChildren()) do
		if v:IsA("Tool") then
			v:Destroy()
			break
		end
	end
	local Tool = Player.Backpack:GetChildren()[bind]
	if Tool then
		local ClonedTool = Tool:Clone()
		ClonedTool.Parent = Player
		Player.Character.Humanoid:EquipTool(ClonedTool)
	end
end)

Found an answer on discord, thanks for reading!
Solution:
Insert a local script inside the tool, fire an event and then destroy the tool from the server side.
CLIENT:

script.Parent.Unequipped:Connect(function()
	game.ReplicatedStorage.Events.DestroyTool:FireServer(script.Parent)
end)

SERVER:

Events.DestroyTool.OnServerEvent:Connect(function(Player, Tool)
	Tool:Destroy()
end)

I probably wouldn’t mark this topic as solved since you didn’t include a solution (It’s misleading to others with the same question). But I’m glad you found your answer.

1 Like

Good point, thank you for explaining me that!

1 Like