I am creating a movement system that essentially applies a velocity to the character and quickly toggles masslessness on and off when the character dashes, double jumps, or wallclimbs. There is a slight delay when massless is toggled to achieve a snappy effect
When this function is triggeded in studio, it works fine. In a published game, it creates a significant lagspike
this was not an issue when this system was written (around august this year)
-
What do you want to achieve?
no lag spike when function is used / new way of achieving the same effect -
What is the issue?
Original results before broken:
-Dash, Double Jump, Wallclimb cause no lag
Now broken results:
-Dash, Double Jump, Wallclimb cause lag spike
Studio test shows no issue:
- What solutions have you tried so far?
Disabling the function entirely- makes movement system watery
Looked for an update that may have caused this issue- couldn’t
Here is the current function:
-- Function to toggle masslessness of the character's parts
-- This function sets the Massless property of all BaseParts in the character
local function toggleCharacterMassless(self: MovementControl, is: boolean): nil
assert(humanoid and root, "MovementController/toggleCharacterMassless Humanoid or RootPart not found")
for _, part in ipairs(character:GetChildren()) do
if part:IsA("BasePart") then
part.Massless = is
end
end
return
end