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.
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.
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?
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)
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)