How do I made fix this script to make it can collide false when the tool's equipped? But when I take the tool out it makes if collidable for a second, which I don't want that. If there's a way to make it can collide false when in the players backpack and when it is dropped, it is collidable so the tool doesnt swing on the floor. The script's location is parented in the tool. The reason I have it is to use the tool without interfearance in the games object world, for instance, taking out the tool when your character facing flat on the wall, and it either pushes the character back or trips it, and I don't want that.
local tool = script.Parent
local Players = game:GetService("Players")
local function setCollidability(collidability)
for _, descendant in pairs(tool:GetDescendants()) do
if descendant:IsA("BasePart") then
descendant.CanCollide = collidability
end
end
end
local owner = Players:GetPlayerFromCharacter(tool.Parent)
setCollidability(not owner)
tool.Equipped:Connect(function()
setCollidability(false)
end)
tool.Unequipped:Connect(function()
setCollidability(true)
end)

1 comment
If you set everything in the tool to CanCollide: true but when you equip the tool, the handle automatically gets CanCollide: false. I re-edited my post check it out