Skip to content

Instantly share code, notes, and snippets.

@gaymeowing
Created November 19, 2025 17:03
Show Gist options
  • Select an option

  • Save gaymeowing/f91b37baea86a1adb5f1383d49103827 to your computer and use it in GitHub Desktop.

Select an option

Save gaymeowing/f91b37baea86a1adb5f1383d49103827 to your computer and use it in GitHub Desktop.
--[[
set mass
sets a parts mass to the given new_mass using PhysicalProperties
]]
local function set_mass(part: BasePart, new_mass: number)
local current_physical_properties = part.CurrentPhysicalProperties
local extents_size = part.ExtentsSize
part.CustomPhysicalProperties = PhysicalProperties.new(
new_mass / (extents_size.X * extents_size.Y * extents_size.Z),
current_physical_properties.Friction,
current_physical_properties.Elasticity,
current_physical_properties.FrictionWeight,
current_physical_properties.ElasticityWeight
)
end
return set_mass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment