We use cookies on this site to enhance your user experience
Collapse Sidebar




Determines the acceleration due to gravity applied to falling BasePart|BaseParts. This value is measured in studs per second squared and by default is set to 196.2 studs/second2. By changing this value, developers can simulate the effects of lower or higher gravity in game.

Code Samples

Low Gravity Button

This script creates a touch pad in the workspace that, when touched, will reduce the game’s gravity. Activating the pad again will switch back to normal gravity.

-- Calculate the moon's gravity
local moonGravityRatio = 1.62 / 9.81
local defaultGravity = 196.2
local moonGravity = defaultGravity * moonGravityRatio

-- Create a touch pad
local pad = Instance.new("Part")
pad.Size = Vector3.new(5, 1, 5)
pad.Position = Vector3.new(0, 0.5, 0)
pad.Anchored = true
pad.BrickColor = BrickColor.new("Bright green")
pad.Parent = workspace

-- Listen for pad touch
local enabled = false
local debounce = false
	if not debounce then
		debounce = true
		-- Toggle gravity between moon and default
		enabled = not enabled 
		workspace.Gravity = enabled and moonGravity or defaultGravity
		-- Change pad color 
		pad.BrickColor = enabled and BrickColor.new("Bright red") or BrickColor.new("Bright green")
		debounce = false