Scripting Helpers is winding down operations and is now read-only. More info→

Log in to vote

0
I am not asking anyone to scirpt for me, I just want to know if there is a way to make someone's jump go higher, or less gravity ingame via a shop. Do you have to add your own script to the character or change the existing one?

0

connor ._., I thought you were an advanced programmer greatneil80 2647 — 5y

0

this was four years ago ronitrocket 120 — 4y

0

True dat WideSteal321 773 — 4y

Log in to vote

13
[ I'm on mobile, so sorry for any errors I have ]

You can just use a BodyForce object to help you counter the force of gravity.

BodyForce applies a constant force on an object. You probably don't know what force is, so I'll explain the basics.

Force is the acceleration multiplied by the mass of an object. The force of gravity then is the gravitational acceleration constant multiplied by the mass of the part.

On ROBLOX, the gravitational constant is equal to 196.2. You can get the mass of a part by using the method `GetMass`

. But, keep in mind that gravity pulls an object downwards. This means we will need a negative sign. So, assuming the variable Part refers to your target Part...

ForceOfGravity = -196.2 * Part:GetMass() -- acceleration multiplied by mass

So how can you use this to your advantage?

If you know the force of gravity, you know the force you need to counteract it.

To completely counter the force of gravity, just insert a BodyForce with the Y component of the force property to the negative of the force of gravity. This will cancel it out because the net force is the sum of all of the forces, so ForceOfGravity + (-ForceOfGravity) = 0.

Instance.new("BodyForce", Part).force = Vector3.new(0, -ForceOfGravity, 0)

But that counteracts gravity for a part. I'm assuming you want to counteract gravity for a player. All you have to figure out is the total mass of the character and recalculate the force of gravity like you did before. Assuming character is a reference to a player's character...

TotalMass = 0 for _, part in pairs(character:GetChildren()) if part:IsA("Part") then TotalMass = TotalMass + part:GetMass() end end ForceOfGravity = -196.2 * TotalMass Instance.new("BodyForce", character.Torso).force = Vector3.new(0, -ForceOfGravity, 0)