Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i make it so all the parts in the players character has collision on?

im sorry if the title isnt clear but im going to try to explain it in better detail here

What i want is for all the parts including head, left leg, arm, etc. to have CanCollide on. I have tried to insert a script into starter character scripts which turns on CanCollide. However when i run it CanCollide just turns of right after i run the game

2 comments

0

I see your problem, but I don't really know how to fix it. It seems there isn't actually a way to get around it, based on the devforum. Nevertheless, I can try to help you find a way around it, if you tell me why you need to change this property for those parts

0

You can create invisible hit boxes and weld them to the parts although it will definitely cut down performance

1 answer

local char = define character location here
for i,v in pairs(char:GetDescendants()) do 
	if v.ClassName == "Part" or v.ClassName == "UnionOperation" or v.ClassName == "MeshPart" then 
		v.CanCollide = true 
		v.Changed:Connect(function(thing) 
			if thing == "CanCollide" and v.CanCollide == false then 
				v.CanCollide = true 
			end
		end)
	end 
end

you can insert this into a script or localscript but if you want other people to collide with the character then put it in a script

keep in mind exploiters can use invisible fling to fling players without knowing who it is if you turn collision on

4 comments

0

will be updating this in a second

0

instead of changed you can use getpropertychangedsignal on the cancollide property but that is up to you

0

i dont think that should really be considered as an option. since roblox automatically changes the cancollide, that event will just fire repetitively, making it no better than using an endless loop to change it. it would be better to come up with an alternate solution

0

also, .Changed doesn't fire on busy properties (namely Position). I wonder if it wouldnt work for this, as well, since it would be firing so often?

This discussion is preserved as it was. New answers, comments, and votes are closed.