Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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

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 Gey4Jesus69 2705 — 3y
0
You can create invisible hit boxes and weld them to the parts although it will definitely cut down performance imKirda 4491 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
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

0
will be updating this in a second MLGwarfare04 183 — 3y
0
instead of changed you can use getpropertychangedsignal on the cancollide property but that is up to you MLGwarfare04 183 — 3y
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 Gey4Jesus69 2705 — 3y
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? Gey4Jesus69 2705 — 3y
Ad

Answer this question