Disabling CanCollide on body parts

I’m trying to disable CanCollide on the UpperTorso and LowerTorso of characters. When I look at the properties, it’s still enabled on both. Here’s my code:

game:GetService('Players').PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		print(c)
		c:WaitForChild('HumanoidRootPart').Size = Vector3.new(1, c.HumanoidRootPart.Size.Y, 1)
		c:WaitForChild('UpperTorso').CanCollide = false
		c:WaitForChild('LowerTorso').CanCollide = false
		print('not waiting forever')
	end)
end)

I added a print statement to make sure it’s not forever stuck on WaitForChild(), and it printed, so I’m sure it’s not waiting forever.

since roblox wants to make it hard on us, you have to disable the collisions every frame

2 Likes

Thanks for the information.

I wrote a script to fix this, but it’s not working. UpperTorso and LowerTorso can still collide.

part:GetPropertyChangedSignal('CanCollide'):Connect(function(x)
	if part.CanCollide == true then
		part.CanCollide = false
	end
end)

Here’s how I used it:

game:GetService('Players').PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		print(c)
		c:WaitForChild('HumanoidRootPart').Size = Vector3.new(1, c.HumanoidRootPart.Size.Y, 1)
		part = c:WaitForChild('UpperTorso')
		part:GetPropertyChangedSignal('CanCollide'):Connect(function(x)
			if part.CanCollide == true then
				part.CanCollide = false
			end
		end)
		part = c:WaitForChild('LowerTorso')
		part:GetPropertyChangedSignal('CanCollide'):Connect(function(x)
			if part.CanCollide == true then
				part.CanCollide = false
			end
		end)
		print('not waiting forever')
	end)
end)

So, I need some help with this script.

i said every frame, using RunService and not checking if its already canCollide. Stepped works more than Hearbeat

1 Like

That works sometimes, but not always.

works all the time for me so you’re probably doing some things wrong

1 Like

This question matters later I promise: why exactly do you want to disable their collisions?

Is it for noclip? Do you just want characters to not collide with each other? Some other reason?

1 Like

I am going to keep the humanoid root part’s collisions enabled, shrink the humanoid root part, and disable collisions on everything else so that players can fit into tighter spaces.

Perhaps I am. Here’s my code:

game:GetService('Players').PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		print(c)
		c:WaitForChild('HumanoidRootPart').Size = Vector3.new(1, c.HumanoidRootPart.Size.Y, 1)
		part = 
		game:GetService('RunService').Stepped:Connect(function(x, y)
			c:WaitForChild('UpperTorso').CanCollide = false
		end)
		game:GetService('RunService').Stepped:Connect(function(x, y)
			c:WaitForChild('LowerTorso').CanCollide = false
		end)
	end)
end)

With just the HRP, the legs will go through the ground (at least in my experience, but that was in R6).

Now that I think about it, the head technically is the other collider (other than the torso) at least in R6, I believe it’s the same. Have you tried also disabling head collisions? (And no, you don’t actually have to constantly disable the collisions on stuff through runservice).

1 Like

In R15, the only colliders are the upper and lower torsos. When I disable those, it still walks properly.

Very interesting. I would try and research noclip scripts for r15 if you haven’t already.

1 Like

you’re using waitforchild (on the server probably) and you have multiple stepped connections, use a single connection for both of them and do not use waitforchild

1 Like

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