Poly Plaza includes a robust Lua scripting system that allows you to create mods and extend game functionality. This guide covers the core functions and features available to Lua scripts.
-- Send a notification to the playerSendNotification("Hello World!")-- Quit the gameQuit()-- Resume from pauseResume()-- Respawn the playerRespawn()-- Save the gameSaveGame()-- Open settings menuOpenSettings()
-- Create a new UI instancelocal ui = CreateUI()-- Configure the UIui.ui = { title = "My Custom Window", elements = { { type = "text", content = "Hello World" } }}-- Show/hide the UIui:Show()ui:Hide()
Here’s a complete example showing various features:
Copy
-- Create a character that opens a UI when interacted withlocal npc = SpawnCharacter({ x = 100, y = 100, z = 0})-- Create UIlocal ui = CreateUI()ui.ui = { title = "NPC Dialog", elements = { { type = "text", content = "Would you like to trade?" } }}-- Add interactionnpc:BindPrimaryInteraction(function() ui:Show()end)-- Get player referencelocal player = GetLocalPlayer()-- Send welcome messageSendNotification("Welcome " .. GetSteamAPI():GetUsername())