nut.currency.spawn - brianhang/nutscript2 GitHub Wiki

Description

entity = nut.currency.spawn(position, amount, setAmountFuncName)

This server function creates a money entity at the given position containing the given amount of money.

Parameters

Name Description
position A Vector for where the money entity will be.
amount A number for how much money the entity contains.
setAmountFuncName An optional string that determines which function is called on the money entity to set its value. By default, this is "SetAmount".

Side Effects

  • An entity is created.

Errors

  • position is not a Vector
  • amount is not a number

Returns

Name Description
entity The money entity if created successfully.

Example

-- Create a money entity at a random position and set it on fire.
local position = Vector(math.random(-256, 256), 0, math.random(-256, 256))
local money = nut.currency.spawn(position, 100)

if (IsValid(money)) then
    money:Ignite(5)
end