Cannot drop cloned tool [SOLVED]

  1. What do you want to achieve? Keep it simple and clear!
    I want the player to be able to drop a tool by pressing backspace.

  2. What is the issue? Include screenshots / videos if possible!
    Not necessarily a scripting question, but I did make a script to clone a tool in ReplicatedStorage to the localplayer; however my player does not drop it when I press backspace. Instead it just deletes from the backpack but the player is still holding the “tool.” Canbedropped is enabled btw.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have tried adding the canbedropped in my tool script, not just having it enabled, but it does nothing and I’m not sure what else to try?

Can you write in tool’s code in the post? It will help.

1 Like

This is the part of my script that clones the tool once I click on a part to give me the tool. It works and gives me the tool, it just doesn’t drop once I press back. Instead it stay on my character but does not show in the backpack.
EDIT: Also forgot to add that the tool does move to the Workspace once I press backspace, but it still appears on my character.

local player = game.Players.LocalPlayer
local PictureButton = game.Workspace:FindFirstChild("PictureButton")
local rep = game:GetService("ReplicatedStorage")

PictureButton.ClickDetector.MouseClick:Connect(function()
	local Picture = rep.Picture:Clone()
	Picture.Parent = player.Backpack
	player.Character.Humanoid:EquipTool(Picture)
end)

You should be cloning the tool from a Server Script. Using a Local Script to clone the tool is likely why you are facing this issue.

2 Likes

Yeah I was thinking this too! Okay I’ll make sure to do it this way and see if it fixes it. Thanks!

1 Like

Here is what your script should look like (in a Server Script):

local PictureButton = game.Workspace:FindFirstChild("PictureButton")
local rep = game:GetService("ReplicatedStorage")

PictureButton.ClickDetector.MouseClick:Connect(function(player) -- first parameter of 'MouseClick' is the player
	if player then -- just to confirm the player isn't nil
		local Picture = rep.Picture:Clone()
		Picture.Parent = player.Backpack
		player.Character.Humanoid:EquipTool(Picture)
	end
end)
1 Like

Thanks! I’ll use this and get back to this later and let u know if it works!

1 Like

It worked! I can drop it now and pick it up too. Thanks a lot it was so simple. c:

1 Like

You are welcome, happy to help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.