Methods

Change the behavior of objects using the following methods.

Player Methods

player:kill()

Restarts the experience.

Lava's Script
self.TouchedPlayer = function(player: Player)
  player:kill()
end
Output

player:updateMainMessage(message)

Displays a message that a player sees in an experience.

chevron-rightParametershashtag
  • message - a string

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

Output

player:updateScoreCounter(score)

Displays a player's score.

chevron-rightParametershashtag
  • score - a number

Output

player:updateTimer(time)

Displays the time for all players in an experience.

chevron-rightParametershashtag
  • time - a number

Output

Self Methods

self:distanceTo(target)

Calculates and returns the distance between self and target.

chevron-rightParametershashtag
  • target - A reference

chevron-rightReturnshashtag

A number

Output

self:moveToward(object, speed, time)

Moves self towards object at a given speed for a specified amount of time.

chevron-rightParametershashtag
  • object - the name of an object

  • speed - a number

  • time - a number in seconds

πŸ€” The name of an object is a property. You can find a list of object properties here.

πŸ€” Make sure that the name of your target object is unique!

Output

self:say(message)

Has an object say a message using a thought bubble.

chevron-rightParametershashtag
  • message - a string

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

Output

World Methods

world:find(object)

Has the world search for an object, and returns a reference to that object if it is found.

chevron-rightParametershashtag
  • object - the name of an object

πŸ€” The name of an object is a property. You can find a list of object properties here.

πŸ€” Make sure that the name of your target object is unique!

chevron-rightReturnshashtag

A reference to an object if it is found. Otherwise, nil is returned.

Imagine the red cube is named "Waldo".

Output

world:getPlayers()

Finds and returns a table of all players found in an experience.

chevron-rightReturnshashtag

A table of player references.

Output

Instance.new(type)

Creates a new object of described type.

chevron-rightParametershashtag
  • type - a class name


world:secondsSinceStart()

Returns the number of seconds that have passed since the play button was pressed.

chevron-rightReturnshashtag

A number.

Output

Last updated