Changing speed of player's attraction to ground

Hey so I made a gamepass that gives player low gravity. I found out that the speed of the player when falling back to the ground is a bit too fast giving the player less control when airborne. I was wondering if someone could update my script to make the speed slower. I am aware of .Gravity but i am unsure on how to use it.

local gamepassId = 25597491
local mps = game:GetService("MarketplaceService")
local players = game:GetService("Players")

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")
		if mps:UserOwnsGamePassAsync(plr.UserId, gamepassId) then
			humanoid.JumpPower = 100
			humanoid.JumpHeight = 40
		end
	end)
end)

Just add a bodyvelocity with certain force that’s not enough to fully lift the player.

Objects with a mass within a gravitational field experience a force, not a (constant)velocity so therefore a body velocity isn’t optimal.

In order to calculate force due to gravity you can use Newton’s second law of motion which is Force(newtons) = mass(kg) * acceleration(m/s^2). Mass can be acquired using :GetMass() and acceleration due to gravity using workspace.Gravity. Try something similar to the below:

function ModelMass(model)
	local totalMass = 0
	
	for _,v in pairs(model:GetDescendants()) do
		if v:IsA("BasePart") then
			totalMass += v:GetMass()
		end
	end
	
	return totalMass
end


game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		--DOESN'T INCLUDE GAMEPASS STUFF
		local humanoidRootPart = Character.HumanoidRootPart
		local counterGravity = Instance.new("BodyForce", humanoidRootPart); counterGravity.Name = "GravityCounter"
		--F = m*a
		local mass = ModelMass(Character)
		local gravitya = workspace.Gravity
		local forcePercentage = 90
		local forceNeeded = mass * gravitya * (forcePercentage / 100)
		counterGravity.Force = Vector3.new(0,forceNeeded,0)
		
	end)
end)
1 Like

I consider this a silly solution compared to the above. But you can change workspace.Gravity in a LocalScript and it will replicate to the server for the given player. I consider a good amount to be workspace.Gravity = 20 in combination with your JumpPower/JumpHeight values and such.

1 Like

It seems like a perfectly good solution to me! If it works.

its a script under serverscriptservice

You can make the entire thing on the client, inside a LocalScript in StarterCharacterScripts:

local mps = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local plr = players.LocalPlayer 
local gamepassId = 25597491

local char = script.Parent 
local humanoid = char:WaitForChild("Humanoid")

if mps:UserOwnsGamePassAsync(plr.UserId, gamepassId) then
	workspace.Gravity = 20 
	humanoid.JumpHeight = 50
end 

Also you don’t have to worry about exploiters cause they can bypass their humanoid properties anyway(such as speed, jumppower etc).

1 Like

Worked perfectly first try, very much appreciated.

1 Like