How do i delete a tool from a player's backpack instead of deleting the entire model?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear! I want to only delete the tool from the players backpack so when i reclone the tool the tool is visible

  2. What is the issue? Include screenshots / videos if possible! When i use :Destory the whole tool model gets deleted.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I spent a couple hours editing my code and messing with it to no avil

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- getting Sound
local Sound = game.ServerStorage.HiddenTool.SledgeHammer.Sound
local Sound_Asset = "rbxassetid://321581454"
-- Getting Players
local Players = game:GetService("Players")
-- Getting the Tool
local Hidden_Tool = game.ServerStorage.HiddenTool.SledgeHammer
-- getting Player Character
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		
		-- Getting the Humanoid
		local Humanoid = Character:WaitForChild("Humanoid")

		-- Getting the Seat 
		local Seat = workspace.SeatModel.SeatPart.Seat

		Humanoid.Seated:Connect(function(Seated)
			
			if Seated then
				print("Seated")
				Hidden_Tool = Hidden_Tool:Clone()
				Hidden_Tool.Parent = Player.Character
					Sound:Play()
					Sound.Looped = true
					Sound.Playing = true
					Sound.Volume = 5
			else
				--Hidden_Tool:Destroy() -- Deletes the entire model :/
				Player.Character:FindFirstChildOfClass("Tool")
				Player.Character:FindFirstChildOfClass("Tool"):Destroy()
			end
		end)
	end)
end)
print("At The end")

So I’m trying to have a tool when a player sits on a seat and if the player leaves that seat, then the tool gets deleted from the players inventory is there any way i can delete a tool from the players backpack without deleting the entire model?

You want to keep the model of the tool while removing it from the backpack?

I am presuming you are trying to remove the tool temporarily while the player is seated?

Exactly what i want to do i don’t want the model deleted

No i’m trying to give the player the tool when they are seated and i’m trying to remove the tool when the player is unseated

If you want to make the player equip the tool when he’s sitting and unequip it if he’s standing, you can parent it to

Player > Character

when he’s sitting, which will make him equip it, and parent it to

Player > Backpack

when he’s standing, which makes him unequip it.

Tools inside their backpack are unequipped and tools inside his character are automatically equipped.

Here:

Humanoid.Seated:Connect(function(Seated)
			
			if Seated then
				print("Seated")
                -- Edit 1 on this line:
				Hidden_Tool =  Player.Backpack:FindFirstChild("Name of your tool here") or Hidden_Tool:Clone() -- This makes sure it doesn't give you a new tool each time
				Hidden_Tool.Parent = Player.Character
					Sound:Play()
					Sound.Looped = true
					Sound.Playing = true
					Sound.Volume = 5
			else
                -- Edit 2 on this line:
				Hidden_Tool.Parent = Player.Backpack -- Now he unequips it :)
				Player.Character:FindFirstChildOfClass("Tool")
				Player.Character:FindFirstChildOfClass("Tool"):Destroy()
			end
		end)
1 Like

There’s a problem where the tool is being cloned multiple times in the backpack each time the player sits

Look at this edit I made:

Humanoid.Seated:Connect(function(Seated)
			
			if Seated then
				print("Seated")
                -- Edit on this line:
				Hidden_Tool =  Player.Backpack:FindFirstChild("Name of your tool here") or Hidden_Tool:Clone() -- This makes sure it doesn't give you a new tool each time
				Hidden_Tool.Parent = Player.Character

This first checks if you already have the tool before giving you a new copy.