Is there a way to stop other tools from being picked up if you already have one in hand?

Hello, developers.

So, I have this baseball game and I need help on something pretty simple, I’d say. Below is a video of my problem. I don’t want to pick up the ball while I have my bat out, but I want to be able to pick it up if I don’t have a bat.

Also, the bat and ball are both tools.

Please help and thank you.

Try locally removing the touch interest

1 Like

Didn’t work; I still picked it up.

Try to locally setting enabled to false

1 Like

This script should work, put it on StarterCharacterScripts

local character = script.Parent
local p = game.Players:GetPlayerFromCharacter(character)

character.ChildAdded:Connect(function(ch)
	if ch:IsA("Tool") then
		task.wait()
		
		for _, c in pairs(character:GetChildren()) do
			if c:IsA("Tool") and c ~= ch then
				ch.Parent = p.Backpack
			end
		end
	end
end)

It basically moves the ball to the backpack if there is already a tool out.

I don’t want it to be moved to the backpack, though. I just want it to stay in the workspace where it is.

Change ch.Parent = p.Backpack to ch.Parent = workspace

If you are still unsatisfied i suggest not making the ball a tool.

And instead putting the viewmodel of the tool and storing the original tool on ServerStorage and a touch script so it gives you the original tool (with checks)

2 Likes