Skip to main content

MLPlayer.SetGravity(number gravityValue, boolean resetVerticalVelocity = false)

Sets the players gravity value. This value changes the gravitational forces applied to the player. Use SetGravityAxis To set the gravitational directions. The value must be between [-50,50]. Default value is -10.

Parameters:

NameTypeDescription
gravityValuenumberNew gravity value. Must between -50 and 50.
resetVerticalVelocitybooleanResets the player's current vertical velocity when updating the gravity.

Usage

---@type MLPlayer
local mlplayer;

---@type number
local gravityValue;

---@type boolean
local resetVerticalVelocity;


mlplayer.SetGravity(gravityValue, resetVerticalVelocity)