Hello!
I wanted to anchor player’s body part when the player touches the ground, but when i did, the whole character got frozen. I checked, and only 1 body part was anchored (like it’s supposed to).
I think it could possibly be because of joints, but i tried using BreakJoints() and it didn’t help. Welding has the same issue. How could I resolve this and stop player from freezing entirely?
The player is R16 and ragdolled when trying to anchor.
-- Anchoring code
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Touched:Connect(function(hit)
if hit.Parent == workspace.MapObjects then
if not Debounce and v.Name ~= "HumanoidRootPart" then
v.Anchored = true
print(v)
end
end
end)
end
end
local function anchorPart(part)
-- Disconnect the part from the character
for _, joint in pairs(part:GetJoints()) do
joint:Destroy()
end
part.Anchored = true
--task.wait(timeToReconnect)
--reconnectPart(part)
]]
end
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Touched:Connect(function(hit)
if hit.Parent == workspace.MapObjects then
if not Debounce and v.Name ~= "HumanoidRootPart" then
anchorPart(v)
print(v)
end
end
end)
end
end
It works, but the ragdoll falls apart. How could I do it so ragdoll stays connected but only parts that touch the ground are anchored and the character doesn’t get frozen? Added footage to make myself clearer. (1 - result using your code, 2 - using the original code)