Collapse Sidebar




The BottomParamA property is relevant when a part’s /BasePart/BottomSurface is set to Motor or SteppingMotor and /BasePart/BottomSurfaceInput is set to Sin. It determines the amplitude of the motor’s rotational velocity, using the following formula:

MotorVelocity = ParamA * math.sin(workspace.DistributedGameTime * ParamB)

There are no other usages for this property.

Code Samples

Motor Control

This code sample demonstrates how surface properties can be set using only a NormalId (Top, Front, etc). It switches a motor’s -SurfaceInput from NoInput, Constant and Sin to show how each work using -ParamA and -ParamB properties.

-- Paste this into a Script inside a part with a Motor SurfaceType
local partMotor = script.Parent
-- Place a brick called "MovingPart" so it is touching the Motor surface
local partMoving = partMotor.Parent.MovingPart

-- For this example, we use TopSurface, TopSurfaceInput, TopParamA and TopParamB
-- However, this will work for all faces (NormalId): Top, Bottom, Left, Right, Front and Back

-- A function to quickly set all surface properties at once 
local function setFaceSurfaceInputParams(normalId, surfaceType, inputType, paramA, paramB)
	local surfaceName = normalId.Name -- e.g. "Top", "Bottom", etc

	-- Syntax Note: in Lua, part.Something is the same as part["Something"]
	-- The difference is that the latter allows us to use a string ("Something"), while
	-- the former requires use of an identifier (.Something). Below, we build of each the surface
	-- properties below by concatenating the surface name with the property postfix.
	-- Set "___Surface", eg "TopSurface"
	partMotor[surfaceName .. "Surface"] = surfaceType
	-- Set "___SurfaceInput", eg "TopSurfaceInput"
	partMotor[surfaceName .. "SurfaceInput"] = inputType
	-- Set "___ParamA", eg "TopParamA"
	partMotor[surfaceName .. "ParamA"] = paramA
	-- Set "___ParamB", eg "TopParamB"
	partMotor[surfaceName .. "ParamB"] = paramB

local normalId = Enum.NormalId.Top

while true do
	-- Set to NoInput, where the motor will not operate at all
	setFaceSurfaceInputParams(normalId, Enum.SurfaceType.Motor, Enum.InputType.NoInput, 0, 0)
	-- Set to Constant, where motor rotational velocity = paramB
	setFaceSurfaceInputParams(normalId, Enum.SurfaceType.Motor, Enum.InputType.Constant, 0, .25)
	-- Set to Sin, where motor rotational velocity = paramA * math.sin(time * paramB)
	-- Since we're using pi (~3.14), the frequency of rotation is 1 second (per definition of sine function)
	setFaceSurfaceInputParams(normalId, Enum.SurfaceType.Motor, Enum.InputType.Sin, .25, math.pi)