Skip to content

Lua examples.

TheHellBox edited this page Nov 6, 2018 · 5 revisions

Move game object (0.4.0)

ent = World.CreateGameObject()
ent:with_model("cube")
ent:with_position(0, 0, 0)
ent = ent:build()
x = 0

AddEvent("Update", "move_object", function()
  x = x + 0.000001
  ent:SetPosition(x, 0, 0)
end)

AddEvent("OnClientConnected", "preload_models", function(id)
  player = Player.GetByID(id)
  script = "World.LoadModel('./assets/models/cube/cube.obj', 'cube')"
  player:SendLua(script)
end)

Clone this wiki locally