Codectionary / Developer documentation / Luau

VectorForce

Apply a continuous force to a physics assembly.

Why use VectorForce?

VectorForce applies force, not a fixed speed. It can model wind or thrust; actual acceleration depends on the assembly mass and other forces.

Try it in Roblox Studio

Create an unanchored Part named Crate in Workspace and put this Script in ServerScriptService. The example creates the attachment that the force needs.

Syntax

force.Attachment0 = attachment
force.Force = Vector3.new(0, 500, 0)

Examples

VectorForce

Apply upward force to a crate.

local crate = workspace:WaitForChild("Crate")
assert(crate:IsA("BasePart"))
local attachment = Instance.new("Attachment")
attachment.Parent = crate

local force = Instance.new("VectorForce")
force.Attachment0 = attachment
force.RelativeTo = Enum.ActuatorRelativeTo.World
force.ApplyAtCenterOfMass = true
force.Force = Vector3.new(0, 500, 0)
force.Parent = crate
  1. Attachment0 identifies where the force acts on the assembly.
  2. RelativeTo = World keeps the upward vector in world coordinates; ApplyAtCenterOfMass reduces unwanted rotation.
  3. A 500-unit force does not guarantee lift because gravity and mass still affect the result.

Best practices

  • Measure mass and adjust force rather than assuming one value works for every object.
  • Keep physics authority and network ownership in mind for multiplayer objects.

Runtime & versions

Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Luau documentation

Specifications & further reading