In my game “Colt 2” I allow players to customize a wide variety of characters. One of the customization options is having the option between a blocky and slim body. For some reason, on what seems like almost random occasions, the slim bodies make the HumanoidRootPart dysfunction and they don’t float or allow the player to move, as they’re intended to do. Sometimes even sending players straight to Position 0, 0, 0 and I don’t know why This has been plaguing me for months and I’m not even sure why this occurs.
Some things to mind:
- Player.Character property r is changed to a pre-made rig that that is edited. This rig has the body/slim changes on it
- Multiple players at a time seems to make this bug occur more often.
- Only one player ever gets this behaviour inside a match
- Occurs on NPCs too
- Occurs more frequently on Playstation 4 in singleplayer
- On extremely rare occasions, the waist joint disconnects
--functions that apply slim body
local libms_to_hit={
"Neck";
"Waist";
"RightShoulder";
"LeftShoulder";
"RightHip";
"LeftHip";
};
function setLimbStatus(char, deb)
local is_temp=false
for i,v in pairs(char:GetChildren()) do
local findClass=v:FindFirstChildOfClass("Motor6D")
if findClass then
local works=false
for j,w in pairs(libms_to_hit) do
if string.find(findClass.Name, w) or string.find(findClass.Name, w.."_TempBlendFix") then
works=true
break
end
end
if works then
findClass.Enabled=deb
findClass.Parent.Anchored=not deb
if string.find(findClass.Name, "_TempBlendFix") then
is_temp=true
end
end
end
end
game["Run Service"].Heartbeat:Wait()
return is_temp
end
function reconnect_motors(char)
game["Run Service"].Heartbeat:Wait()
pcall(function()
char.LowerTorso:FindFirstChildWhichIsA("Motor6D").Part0=char.HumanoidRootPart
char.LowerTorso:FindFirstChildWhichIsA("Motor6D").Part1=char.LowerTorso
char.UpperTorso:FindFirstChildWhichIsA("Motor6D").Part0=char.LowerTorso
char.UpperTorso:FindFirstChildWhichIsA("Motor6D").Part1=char.UpperTorso
char.RightUpperArm:FindFirstChildWhichIsA("Motor6D").Part0=char.UpperTorso
char.Head:FindFirstChildWhichIsA("Motor6D").Part0=char.UpperTorso
char.LeftUpperArm:FindFirstChildWhichIsA("Motor6D").Part0=char.UpperTorso
char.LeftUpperLeg:FindFirstChildWhichIsA("Motor6D").Part0=char.LowerTorso
char.RightUpperLeg:FindFirstChildWhichIsA("Motor6D").Part0=char.LowerTorso
end)
game["Run Service"].Heartbeat:Wait()
end
function applyMeshChanges(target_mesh, reference, is_temp_fix)
local newPart=reference:Clone()
for i,v in pairs(target_mesh:GetChildren()) do
if v.Name=="OriginalSize" or v:IsA("Motor6D") then continue end
v.Parent=newPart
end
newPart.CFrame=target_mesh.CFrame
newPart.Anchored=false
newPart.Color=reference.Color
local motor=newPart:FindFirstChildOfClass("Motor6D")
is_temp_fix= target_mesh.Parent:FindFirstChild("Neck_TempBlendFix", true)
if is_temp_fix then
motor.Name=motor.Name.."_TempBlendFix"
end
newPart.Parent=target_mesh.Parent
target_mesh:Destroy()
game["Run Service"].Heartbeat:Wait()
end
function applyBodyType(char, rigType)
local SlimRig=game.ReplicatedStorage:WaitForChild("Character"):FindFirstChild(rigType)
local is_temp_fix= setLimbStatus(char, false)
SlimRig:PivotTo(char:GetPivot())
applyMeshChanges(char.LowerTorso, SlimRig.LowerTorso, is_temp_fix)
applyMeshChanges(char.UpperTorso, SlimRig.UpperTorso, is_temp_fix)
reconnect_motors(char)
game["Run Service"].Heartbeat:Wait()
SlimRig:PivotTo(CFrame.new())
setLimbStatus(char, true)
game["Run Service"].Heartbeat:Wait()
end
--part that applies it
if CharData.BT==1 then
applyBodyType(Char, "SlimRigRef")
end