VectorForce not working properly

I’m trying to add a dashing ability to my game, and VectorForce does not seem to work correctly.

It works different when the player holds objects that have a different mass (even though my code accounts for that), and works completely different in the game itself when testing

In game, the VectorForce barely works, but works well enough in studio

Here is my code for calculating the force required

local Mass = GetPlrMass(Char)
local Dir = Vector3.new(Char.Humanoid.MoveDirection.X,0,Char.Humanoid.MoveDirection.Z)
local Force = Dir * 30 * Mass

and the GetPlrMass function used here

local function GetPlrMass(char)
	local Mass = 0
	for i,v in pairs(char:GetDescendants()) do
		if not v:IsA("BasePart") then continue end
		Mass += v.AssemblyMass
	end
	return Mass
end

Assembly mass is already the mass of all the parts no need to loop it.

Otherwise use .Mass

Oh thanks, I didn’t realise it was for all parts

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.