Garry's Mod: Bone Scale Bug After Update?

by Alex Johnson 42 views

Experiencing issues with bone scale manipulation in Garry's Mod after the latest update? You're not alone! This article dives into a specific problem reported by a Garry's Mod user regarding the ManipulateBoneScale function and its unexpected behavior following a recent game update. We'll explore the details of the issue, the steps to reproduce it, and potential causes. Let's get started!

The Problem: Bone Scaling Not Working as Expected

The main issue revolves around a custom Lua server-side function designed to shrink the head of ragdoll entities. This function, which previously worked flawlessly, has stopped visually affecting the bone scale on the client-side after a recent Garry's Mod update. The function still executes on the server, but the changes are not reflected in the game's visuals for players. This means that while the server logic correctly calculates the new bone scales, the clients don't receive or process this information, leading to a discrepancy between the server's state and the client's rendering.

The user specifically identified commit 570387 as a potential source of the problem, as it's the most recent update mentioning anything related to bone manipulation. However, it's important to note that this is an assumption, and further investigation might be needed to pinpoint the exact cause. The error message appearing in the console, "Refusing to set parent on manipulate_bone!", provides a crucial clue, suggesting a potential issue with how bone parenting or attachment is handled after the update. This error message indicates that the game is encountering a problem when trying to apply the manipulated bone scale within the existing skeletal hierarchy.

Keywords: Garry's Mod, bone scale, ManipulateBoneScale, update, bug, Lua, server-side, client-side, ragdoll, error message

Diving Deep into the Lua Code

Let's examine the provided Lua code snippets to understand the function and its implementation:

function ShrinkHead(ent)
 if IsValid(ent) then
 local finished = false
 for i = 0, ent:GetBoneCount() - 1 do
 local factor = 0.96
 if (string.find(ent:GetBoneName(i), "Head")) then
 ent:ManipulateBoneScale(i, Vector(ent:GetManipulateBoneScale(i).x * factor, ent:GetManipulateBoneScale(i).y * factor, ent:GetManipulateBoneScale(i).z * factor))
 if ent:GetManipulateBoneScale(i):Length() <= 0.18 then
 finished = true
 end
 end
 end
 return finished
 end
 return false
end

This ShrinkHead function iterates through each bone of the given entity (ent). If a bone's name contains "Head", the function scales down the bone's size by a factor of 0.96. It continues scaling the head bones until their overall length (Length()) is less than or equal to 0.18, at which point it marks the process as finished. The function uses the ent:ManipulateBoneScale(i, ...) function to modify the scale of the bone at index i. This is the core function at the heart of the issue.

The following code snippet demonstrates how the ShrinkHead function is called using a timer:

hook.Add( "OnEntityCreated", "ShrinkDeadHead", function( ent )
 timer.Simple(0.1, function()
 if IsValid(ent) && ent:IsRagdoll() then
 local timerName = "CorpseShrinkHead_" .. ent:EntIndex()

 timer.Create(timerName, 0, 0, function()
 if !IsValid(ent) then
 timer.Remove(timerName)
 return
 end

 if ShrinkHead(ent) == true then
 timer.Remove(timerName)
 return
 end
 end)
 end
 end)
end )

This code sets up a hook that triggers when an entity is created. It checks if the entity is a ragdoll and, if so, creates a timer that repeatedly calls the ShrinkHead function. This timer-based approach allows the head to shrink gradually over time. The issue arises in how this scaling is visually represented on the client-side after the mentioned update. The server-side function still executes, but the client-side visuals remain unchanged.

Keywords: Garry's Mod, Lua code, ShrinkHead function, ManipulateBoneScale, bone scaling, server-side, client-side, timer, ragdoll, entity

Steps to Reproduce the Issue

The user provided clear steps to reproduce the problem, which is crucial for debugging and fixing the bug:

  1. Create a server-side ragdoll entity.
  2. Use a timer or another mechanism to repeatedly call the ShrinkHead function on the ragdoll.
  3. Observe that the head bones of the ragdoll do not visually shrink on the client-side, even though the server-side function reports that the scaling is happening.
  4. Check the console for the error message "Refusing to set parent on manipulate_bone!".

These steps effectively isolate the issue and allow developers or other users to confirm the bug on their systems. The presence of the error message is a strong indicator of the underlying problem.

Keywords: Garry's Mod, reproduce bug, steps, server-side, ragdoll, ShrinkHead function, client-side, error message, console

Possible Causes and Solutions

Based on the information provided, here are some potential causes and possible solutions for this issue:

  1. Changes in Bone Parenting or Attachment: The error message "Refusing to set parent on manipulate_bone!" strongly suggests that the update might have introduced changes in how bones are parented or attached within the skeletal hierarchy. The ManipulateBoneScale function might be trying to modify a bone in a way that violates these new constraints.

    • Possible Solution: Investigate the changes in commit 570387 and subsequent updates to understand the new bone parenting rules. Modify the ShrinkHead function to comply with these rules, potentially by adjusting the order in which bones are scaled or by using alternative methods for manipulating bone scale.
  2. Client-Side Update Lag: It's possible that the server is correctly sending the bone scale updates, but the client is not processing them in a timely manner. This could be due to network latency, client-side performance issues, or a bug in the client's bone update mechanism.

    • Possible Solution: Ensure that the bone scale updates are being sent to the client reliably. Optimize the client-side code to efficiently process bone updates. Consider using client-side prediction to smooth out the visual changes.
  3. Incompatibility with New Game Version: The issue might be caused by an incompatibility between the custom Lua code and the new Garry's Mod version. Certain functions or behaviors might have changed, rendering the existing code ineffective.

    • Possible Solution: Review the Garry's Mod changelogs and documentation for any changes related to bone manipulation or entity handling. Update the Lua code to be compatible with the new game version.
  4. Bug in Garry's Mod Engine: It's also possible that the update introduced a bug in the Garry's Mod engine itself, specifically in the ManipulateBoneScale function or related systems.

    • Possible Solution: Report the bug to the Garry's Mod developers through the appropriate channels (e.g., Facepunch forums, GitHub). Provide detailed information about the issue, including the steps to reproduce it and the error message. The developers can then investigate the engine code and implement a fix.

Keywords: Garry's Mod, causes, solutions, bone parenting, update lag, client-side, incompatibility, bug, engine, ManipulateBoneScale

Version Information and Beta Status

The user provided valuable version information, which is crucial for debugging:

  • Protocol version: 24
  • Network version: 2025.03.26 (garrysmod)
  • Exe build: 20:49:49 Nov 26 2025 (9881) (4000)
  • GMod version: 2025.11.26, branch: dev, multicore: 1
  • Windows 32bit
  • Beta: Dev beta

This information indicates that the user is running a development beta version of Garry's Mod. Beta versions are known to be less stable and may contain bugs. This increases the likelihood that the issue is related to a recent change in the game engine.

Keywords: Garry's Mod, version information, beta, dev beta, debugging, stability, engine

Conclusion

The bone scale manipulation issue in Garry's Mod after the recent update is a significant problem that affects custom Lua scripts relying on the ManipulateBoneScale function. The error message "Refusing to set parent on manipulate_bone!" provides a valuable clue, suggesting a potential issue with bone parenting or attachment. By understanding the code, the steps to reproduce the problem, and the possible causes, developers and users can work together to find a solution. Reporting the bug to the Garry's Mod developers is crucial to ensure that the issue is addressed in a future update.

If you're experiencing this issue, make sure to check the Facepunch Garry's Mod forums for updates and discussions. You can also contribute by providing more information or testing potential fixes. Let's work together to make Garry's Mod even better!