Gorilla Tag Custom Map Luau API (Simplified)

This is a simplified, community-compiled documentation for Gorilla Tag custom map Luau scripting. All logic must be written in Luau and assigned via the Custom Gamemode TextAsset field in Unity.

๐Ÿ”„ Lifecycle Functions

function OnGameStart()
Called when the game session starts. Use it to initialize timers, player data, or GameObjects.
function OnGameStart()
  print("Game has started!")
end
function OnGameEnd()
Called when the game session ends. Great for cleanup or final scoring.
function OnGameEnd()
  print("Game over!")
end
function tick(dt)
Called every frame. Use this for time-based logic like hunger decay or cooldowns. Avoid expensive operations.
function tick(dt)
  timer = timer + dt
  if timer > 5 then
    print("5 seconds passed!")
    timer = 0
  end
end

๐Ÿง Player Events

function OnPlayerJoin(player)
Triggered when a new player joins. Useful for sending welcome messages or initializing per-player data.
function OnPlayerJoin(player)
  player:SendMessage("Welcome, " .. player.name .. "!")
end
function OnPlayerTagged(victim, tagger)
Fired when a player is tagged. Can be used for scoring or special tag rules.
function OnPlayerTagged(victim, tagger)
  tagger:SendMessage("You tagged someone!")
end

๐Ÿ›ฐ Networking

emitEvent(tag: string, data: table)
Broadcasts a custom event to all clients. You can sync state or trigger reactions.
emitEvent("buttonPressed", { who = player.name })
function onEvent(tag, data)
Handles events emitted via emitEvent or triggered by map interactions.
function onEvent(tag, data)
  if tag == "buttonPressed" then
    print(data.who .. " pressed a button")
  end
end

๐ŸŽฎ Player Utilities

player:SendMessage(text: string)
Displays a message on the player's screen in VR.
player:SendMessage("You got a point!")
player.position
Returns the playerโ€™s current position as a Vector3. Useful for proximity-based logic.
if player.position.y > 10 then
  player:SendMessage("You climbed high!")
end

๐Ÿงฑ GameObject Control

findGameObject(name: string)
Returns a reference to a GameObject by name. You can then change its visibility or collision.
local obj = findGameObject("FloppaButton")
if obj then obj:setVisibility(false) end
gameObject:setVisibility(true/false)
Shows or hides the GameObject in the scene.
gameObject:setVisibility(true)
gameObject:setCollision(true/false)
Enables or disables collisions for that GameObject.
gameObject:setCollision(false)

๐Ÿ”Š Audio

playSound(index: number, position: Vector3, volume: number)
Plays a registered sound at a specific location in the map.
playSound(1, player.position, 1.0)

๐Ÿ“Ÿ Input Events

onEvent("touchedGameObject", {player, gameObject})
Triggered when a player touches a collider in the scene (usually buttons or zones).
function onEvent(tag, data)
  if tag == "touchedGameObject" then
    data.player:SendMessage("You touched " .. data.gameObject.name)
  end
end

๐Ÿ’ก Tips

Made by @tagdoesnothing._. on Discord