Only pick up tool if condition is met

I’m trying to make a player-specific condition be checked on tool pickup, if it’s matched the player cannot pick up the tool. I’m having trouble with finding a way to do this. I’ve searched the forums quite a bit and surprisingly couldn’t find anyone asking about this.

How do you want the player to pick up the tool, by touching it?

Yeah. Traditional touch interest. I’m figuring out a workaround right now so I’ll follow up on this post once I have one.

How many conditions are there to be checked?

Found a work around that acts as a TouchInterest would.

local DummyCondition = true -- Change this to whatever condition you would like to match.

script.Parent.Touched:Connect(function(part)
	if part.Parent:FindFirstChild('Humanoid') then
		if DummyCondition then
			script.Parent.Parent.Parent = part.Parent
		end
	end
end)

have a hitbox for the tool, inside that hitbox ;

script.Parent.Touched:Connect(function(Hit)
       local char = Hit.Parent:FindFirstAncestorWhichIsA("Model")
      if char == -- do your checks here
           tool.Parent = game.Players:GetPlayerFromCharacter(char).Backpack
      end
1 Like

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