Tool dropping but the player can't pick it up

I am trying to make a Tool dropping script. It works but if the player isn’t holding the tool when they drop it they can’t pick it back up but if they are holding it when they drop it they can pick it up. The code is a local script and the code is in the tool.

The Code
local UserInputService = game:GetService("UserInputService")
local Tool = script.Parent

UserInputService.InputBegan:Connect(function(inputObject)
    if inputObject.UserInputType == Enum.UserInputType.Keyboard then
		local value = inputObject.KeyCode.Value
		if value == 113 and Tool.Parent.Name == "Backpack" or value == 113 and Tool.Parent:FindFirstChild("Humanoid") then
			Tool.Parent = workspace
		end
	end
end)
1 Like

if it’s a tool then have you tried making an equip script

Yes, but failed I am still working on that

You dont need that what matters is that you have done the following steps

  1. The Tool’s Part Name Is Handle
    2.Uncheck RequiresHandle if you dont want to name the part Handle
    These properties can be seen in the tool properties

Roblox Does The Equipping Automatically

Your issues could be

1.Not the part name Is Handle
2.CanCollide is False and anchored
3.Make sure that they have tool or else it would return nil

That’s All Pretty Much I guess

1 Like

Use Normal Script instead of LocalScript to drop your tool

I recommended you to use RemoteEvent

I hope this help you :smiley:

1 Like

Hello,
Are you useing a custom backpack or roblox backpack

I am using Roblox Backpack (30)

The issue is that the tool is being dropped locally, and consequently, it does not exist on the server and only for the player/client (this also causes the weird inability to get the tool back, if the tool was on the backpack.), since you are changing the parent property from a local script.

You need to add a remote, (RemoteEvent preferably, like @Tonnumkung4 mentioned.) put it in the tool and also add a normal script along with it that listens to the event and drops the tool. (use RemoteEvent:FireServer() on the local script, and RemoteEvent.OnServerEvent() on the normal script.)
Oh and I adjusted the backpack and character checks for you.

The scripts should be like these:

Local Script
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character
local Tool = script.Parent
local DropRemote = Tool.Drop --you can change the name of the remote to anything else if you want to

UserInputService.InputBegan:Connect(function(inputObject)
    if inputObject.UserInputType == Enum.UserInputType.Keyboard then
		local value = inputObject.KeyCode.Value
		if value == 113 and Tool.Parent == Player.Backpack or value == 113 and Tool.Parent == Character then
			DropRemote:FireServer(Player)
		end
	end
end)
Server/Normal Script
local Tool = script.Parent
local DropRemote = Tool.Drop

DropRemote.OnServerEvent:Connect(function(Player)
	if Tool.Parent ~= workspace then
		Tool.Parent = workspace
	end
end)

At last, it probably should look like this from the explorer:

tool

2 Likes