I’m making a custom character’s arms ragdoll by replacing the joint with a rope constraint, but they go through the body because their CanCollide is set to false. I’ve tried using collision groups, but they also require CanCollide. How can I set the custom character’s CanCollide to true?
Go into the properties of the arms and turn on cancollide
I tried that, but they automatically get set to false once the character moves.
If you are saying you replacing the joint with rope constraint, you can try this in your script:
for i, v in pairs(character:GetDescendants()) do --or whatever your path to character is
if v:IsA("BasePart") and v.CanCollide == false then
v.CanCollide = true
end
end
writing from phone
Roblox keeps setting the collision of player parts to false every frame. Setting it to true once won’t cut it. You can loop through the parts in a local script using .RenderStepped to combat this. I do not recommend setting all parts to CanCollide true because it messes with the physics a lot.
i did some quick testing and the character arms keep cancollide on if you change property while game is running so maybe a script would work
This worked! I just added while wait(0.1) to the beggining!
Here’s the script. It’s a server script inside of starterCharacterScripts.
while wait(0.1) do
for i, v in pairs(script.Parent:GetDescendants()) do --or whatever your path to character is
if v:IsA("BasePart") and v.CanCollide == false then
v.CanCollide = true
end
end
end
while wait(0.1) do
is not the best idea i guess, how mikulas12
said you can use game:GetService("RunService").RenderStepped:Connect(function() end)
That’s great to hear. Roblox just loves to make our lives harder.
I think that might be too laggy. Wait(0.1) isn’t the most reliable solution, but it works well enough.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.