I made a simple ragdoll script so the player will ragdoll on death, but its an immersion breaker when the player’s arms or legs go inside of the torso. Is there a way to toggle collisions for the parts?
Use Runservice.Stepped to repeatedly make the parts cancollide set to true.
local RunService = game:GetService("RunService")
RunService.Stepped:Connect(function()
for i,v in pairs(character:GetDecendants()) do
if v:IsA("BasePart") then
v.CanCollide = true
end
end)
oh my god
please do not do this
wait whats wrong with this? Am i supposed to put collision groups?
if you are going through every single descendant of a character and setting a property of it, it lags hard
also it will make the player noclip
you should use collision groups or only set the cancollide however frequently is absolutely nescessary, you can make it less spammy by enabling workspace.HumanoidOnlySetCollisionsOnStateChange
What you could do is make a clone of the player who died and ragdoll the clone, and set all the BaseParts CanCollied to true. Then you can either delete or the original player character or set its BaseParts to be transparent. Since changing the CanCollide of a player Character’s body parts will get reverted back to the original value, this is a more efficient method of doing what you want to do with your script.
Oh, that makes sense, sorry about my Idea, i will use collision groups. (Lots of work to redo i guess)
no need to apologize, it’s just an opportunity to learn