Collision Tools

How can i avoid this? the character will be stuck until i deselect the tool

RobloxScreenShot20220202_035336250

Setting the tool as non collidable just falls in the void
Setting a different collision group doesn’t work, it will pass trough walls if dropped and can be exploited

Are the parts inside the tool anchored?

Also, non-collidable tools fall if they aren’t anchored.

Put the tool as unequipped (or inside the players backpack), when the wall is touched.

The tool is just welded and not anchored, i need it this way so it can be dropped on the ground

This could work but i need the tool on hand to be used

Simple, just put it in the players backpack, move them a few studs away, then place it back in their character!

When you place a tool on workspace and run the game and the tool has can-collide and anchored to false, even though there’s something below it, it will still fall.

An exception to this rule is when you instantly put the object in the player’s backpack, then drop it by pressing Backspace (if CanBeDropped is set to true)

What are you even trying to achieve? I’m confused.

script.Parent.Equipped:Connect(function()
	for i,v in ipairs(script.Parent:GetChildren()) do
		if v:IsA("Part") then
			v.CanCollide = false
		end
	end
end)

It was simplier than i thought

3 Likes

What do you even want to achieve? Do you want it so that they can pick the tool on the ground?

remember to set CanCollide to true when its Unequipped

2 Likes

The tool is designed to be picked up when on ground, can be droped, must be equipped to be used (as hammer is used for walls and more) the only problem was that players can be stuck when equipped

1 Like
local Tool = script.Parent

local function ToggleCollisions(Boolean)
	for _, Child in ipairs(Tool:GetChildren()) do
		if Child:IsA("BasePart") then
			Child.CanCollide = Boolean
		end
	end
end

Tool.Equipped:Connect(function()
	ToggleCollisions(false) --Disable collisions while equipped.
end)

Tool.Unequipped:Connect(function()
	ToggleCollisions(true) --Enable collisions while unequipped (in case the tool is dropped).
end)

Just a little more functionality to the script you already posted.

1 Like

Do tools need to be collidable, because they work fine non-collidable?