Wax

Your character

game.Me gives your character's health, food, level and place by name, tells you when they change, and lets you change them.

game.Me is your own character. You read its numbers by name, and it has signals that fire when they change.

init.lua
local hud = ui.Overlay({ title = "Me", anchor = "top-left", width = 240 })
local health = hud:Field("Health", "")
local level = hud:Field("Level", "")

local function show()
    if not game.Me.Exists then return end
    health:Set(game.Me.Health .. " / " .. game.Me.MaxHealth)
    level:Set(game.Me.Level)
end

show()
game.Me.HealthChanged:Connect(show)
game.Me.LevelUp:Connect(show)
game.Me.Spawned:Connect(show)

It is always there

game.Character is nil at the main menu and is a new object after every map change. game.Me is not an object of the game. It finds your character each time you use it, so you can keep it and connect to its signals once.

While you have no characterWhat happens
game.Me.Existsfalse
Reading a field, such as game.Me.Healthnil
Calling a function or assigning a fieldAn error that says there is no character.

game.Me.Character is the character itself, as an Instance, or nil. Use it where a function wants an Instance.

What you can read

Every field asks the game when you read it.

FieldWhat it is
Health, MaxHealthHealth now, and when it is full.
Stamina, MaxStaminaStamina now, and when it is full.
Food, MaxFoodHow much food is left.
Water, MaxWaterHow much water is left.
Oxygen, MaxOxygenHow much oxygen is left.
Armor, MaxArmorArmour now, and the most it can be.
Alivefalse once the character is dead.
Level, XPThe level, and all the experience earned.
Weight, MaxWeightWhat is carried and what can be carried, in kilograms.
PositionWhere it is, as { X = , Y = , Z = }. 100 is one metre.
RotationWhich way the body is turned, in degrees.
Velocity, MoveSpeedHow fast it moves now, and its top walking speed.
BiomeThe biome it stands in, such as "Conifer".
Temperature, BodyTemperatureThe temperature around it and of its body.
Crouching, Swimming, InCavetrue while it does that.
PlayerNameThe name of the player.
CharacterNameThe name the player gave the character, as the character screen shows it.

A field is nil when the character has no such value. game.Me:DistanceTo(target) gives the metres to an Instance or a position.

What the character carries is on Items and inventories. Its other numbers, and the effects that are on it, are on Stats and modifiers.

Signals

init.lua
game.Me.FoodChanged:Connect(function(food, previous)
    if food < 20 and previous >= 20 then
        ui.Notify("You are getting hungry.", { kind = "warn" })
    end
end)

game.Me.BiomeChanged:Connect(function(biome)
    ui.Notify("You are now in " .. biome)
end)
SignalFires whenYour function gets
HealthChanged, StaminaChangedThe number is not what it was.The new value and the one before.
FoodChanged, WaterChanged, OxygenChangedThe number is not what it was.The new value and the one before.
WeightChangedThe weight carried changed.The new weight and the one before.
LevelUpThe level went up.The new level and the one before.
XPGainedExperience was earned.How much, and the total.
BiomeChangedThe character stands in another biome.The new biome and the one before.
ModifierAdded, ModifierRemovedAn effect came onto the character or left it.The modifier.
Damaged, DiedThe character was hit, or is dead.See Events of the game.
ItemAdded, ItemRemoved, ItemChangedWhat the character carries changed.See Events of the game.
EquippedThe hotbar slot in hand, or the item in it, changed.The stack in hand, and the name of the item that was there. See Items and inventories.
Activatedstack:Activate ran.The stack, and the use name. See Items and inventories.
RespawnedThe character is alive after it was dead.The character.
Spawned, DespawnedA character appeared where there was none, or the one that was there is gone.The character, for Spawned.

Most of these are fed by looking at the character a few times a second, and only while something is connected. So a signal you do not use costs nothing, and a value that changes and changes back between two looks is not told. With twelve signals connected, Wax used about 0.02 ms more a frame.

The signals stay connected through a respawn and a map change.

Any character

The same fields are on every character, not only yours: another player's, and nearly every creature. Food, Water, Oxygen, the weight and the inventories are on players' characters only.

init.lua
for _, character in ipairs(game.Players:GetCharacters()) do
    print(character.PlayerName, character.Health, character.Level)
end

An Instance of a character has Damaged and Died too. The other signals in the table above belong to game.Me. To follow another value of any object, see Watching a value.

What you can change

Each of these is the game's own call.

init.lua
local window = ui.Window({ title = "Helper", width = 280, height = 200 })

window:Button("Heal me", function()
    game.Me:Heal()
    game.Me.Food = game.Me.MaxFood
    game.Me.Water = game.Me.MaxWater
end)
You writeWhat it does
character.Health = 150Sets the health. Never more than MaxHealth. Below 1 raises an error: use Kill.
character.Stamina = 50Sets the stamina, between 0 and MaxStamina.
character.Food = 80Sets the food. Water and Oxygen work the same way. Players' characters only.
character:Heal(amount)Gives health back. Without an amount, all of it. It does not bring a dead character back.
character:Kill()Kills a creature at once. On a player's character it raises an error in this version.
character:Teleport(place, facing)Moves the character at once. place is a position, an Instance or game.Me.
character.Position = { 5, 5, 5 }The same, by assigning. { X = , Y = , Z = }, an Instance and game.Me work too.
character.Rotation = { Yaw = 90 }Turns it. What you leave out stays as it is.
  • Teleport puts the character exactly where you say. Above the ground, it falls and can take damage.
  • No other field can be assigned.
  • What a mod changed stays changed when the mod unloads.

Giving and taking items is on Items and inventories. Putting an effect on a character is on Stats and modifiers.

Every field and function is listed in the Characters reference.

On this page