Pets

The following methods and properties are available in the Overworld for pets. Unless specified, the method or property described is available for all pets.

πŸ€” Each pet is a Tagged Object and has access to the same properties and methods as other Tagged Objects.


Pet Methods

OPTION 1:

pet:distance(target)

Calculates and returns the distance between the pet and a target.

Parameters:

target - a tag or a reference to a Tagged Object.

Returns:

A number.

OPTION 2:

pet:distance(target)

Calculates and returns the distance between the pet and a target.

Parameters:

Returns:

  • A number.


pet:findNearest(tag)

Finds the closest object with tag and returns a reference to the object

chevron-rightParametershashtag
  • tag - a tag to find

πŸ€” Here is the list of available Tags that you can pass to findNearest.

chevron-rightReturnshashtag
  • A reference to the nearest object with a given tag or nil.

πŸ€” If the tagged object is outside the vision range of your pet, nil will be returned.


pet:hit(target)

Asks a pet to hit the closest target.

chevron-rightParametershashtag

πŸ€” Your pet will hit the closest, hittable object if you don't pass an argument to hit.

πŸ€” Here is the list of available Tags that you can pass to hit.

Output

pet:moveTo(position)

Gets a pet to move to a specific position .

chevron-rightParametershashtag

πŸ€” Here is the list of available Tags that you can pass to moveTo.

πŸ€” Here is the list of available Global References that you can pass to moveTo.

GIF


pet:say(message)

Has a pet say a message using a thought bubble.

chevron-rightParametershashtag
  • message - a string

πŸ€” Unicodearrow-up-right is supported.

Output

pet:spin()

Has the pet hit objects found within a specific area.

Output

πŸ€” The range of damage is described the size of the circle.

πŸ€” Pets can only spin once they have reached level 2!


pet:wait(time)

Has the pet wait for a specific amount of time before executing the next line of code.

chevron-rightParametershashtag
  • time - a number

πŸ€” time is in seconds.

Output

pet:findAll(tag, range?)

Finds all Tagged objects with tag in the range (if defined) and returns an array of tagged objects or empty array

chevron-rightParametershashtag
  • tag - the tag that we check

    • type: string

  • range - the distance in studs what we are looking for

    • type: number

    • optional

    • default: 200

πŸ€” Here is the list of available Tags that you can pass to findAll.

chevron-rightReturnshashtag
  • An array of Tagged objects with the given tag.

Last updated