local pos_1, pos_2, pos_3 -- Variables to store X, Y, Z coordinates local X_input = nil -- ID of X input box (to be replaced with actual ID) local Y_input = nil -- ID of Y input box (to be replaced with actual ID) local Z_input = nil -- ID of Z input box (to be replaced with actual ID) local teleport_button = nil -- ID of teleport button (to be replaced with actual ID) -- Function to handle UI events function teleport(e) local location = tonumber(e.content) -- Extract the numerical content from UI event local player_id = e.eventobjid -- ID of the player who triggered the event -- Do not edit -- Check which UI element triggered the event and update corresponding position variable if e.uielement == X_input then pos_1 = location -- Store X coordinate end if e.uielement == Y_input then pos_2 = location -- Store Y coordinate end if e.uielement == Z_input then pos_3 = location -- Store Z coordinate end -- If the teleport button is clicked, attempt to teleport the player if e.uielement == teleport_button then -- Check if all coordinates (pos_1, pos_2, pos_3) are set if pos_1 and pos_2 and pos_3 then -- Teleport the player to the specified coordinates Player:setPosition(player_id, pos_1, pos_2, pos_3) -- Notify the player that teleportation was successful Player:notifyGameInfo2Self(player_id, "Teleportation successful") else -- Notify the player that teleportation failed due to incomplete coordinates Player:notifyGameInfo2Self(player_id, "Teleportation failed: Coordinates are not fully set! Please try again") end end end -- Register the teleport function to handle UI events for lost focus and button clicks ScriptSupportEvent:registerEvent("UI.LostFocus", teleport) ScriptSupportEvent:registerEvent("UI.Button.Click", teleport)
If you have any questions about Developer Tools, feel free to join our official discord server Mini World Global DEV discord