Skip to content

Player:CanAfford

Check whether this player can afford.

player:CanAfford(objectType, isBuilding)

Inputs: objectType is an integer object type ID; isBuilding is a boolean building selector.

Output: Boolean or nil. Exact player-specific object affordability; nil when unavailable. The legacy isBuilding argument remains accepted.

Errors and unavailable states: A wrong receiver or argument type can raise a Lua argument error. An unavailable live read returns nil as described in Output.

See Lua values and game objects for lifetime and enum guidance.