### Start NetworkServer on Port Source: https://rbxlegacy.wiki/index.php/Start_%28Method%29 Starts a server on the specified port using the NetworkServer class. This example demonstrates starting a server on port 53640, which is the default port for Roblox's 'Tools -> Test -> Start Server' functionality. ```Lua game:GetService("NetworkServer"):Start(53640) -- Starts a server on port 53640, the same port used by Tools -> Test -> Start Server ``` -------------------------------- ### Create Example Box with Multi-line Text and Code Source: https://rbxlegacy.wiki/index.php/Template%3AExample This template is used to create a formatted 'Example' box. It supports multi-line text and can include code snippets within the example. The example is closed with a double right curly brace. ```Wiki Markup {{Example|This is an example. They can go several lines. They can also contain code snippets And they're closed with a double right curly brace ({{))}}) }} ``` -------------------------------- ### Start a download Source: https://rbxlegacy.wiki/index.php/User%3ATomtomn00/GRWS Initiates a download by creating a Downloader object and calling its start method. Returns the Downloader object or an error string if the browser is unsupported. ```JavaScript function startDownload(url, id, callback) { var d=newDownload(url, id, callback); if (typeof d == typeof _ ) { return d; }_ d.start(); return d; } ``` -------------------------------- ### Complete Roblox Script Example Source: https://rbxlegacy.wiki/index.php/Absolute_beginner%27s_guide_to_scripting This is a complete Roblox Lua script that references a brick, defines a function to toggle its transparency when touched, and connects the 'Touched' event to that function. ```Lua local brick = workspace.Brick -- Store a reference to the brick. local function onTouched(part) -- The function that runs when the part is touched. brick.Transparency = 1 wait(1) brick.Transparency = 0 end brick.Touched:connect(onTouched) -- The line that connects the function to the event. ``` -------------------------------- ### Complete Roblox Script Example Source: https://rbxlegacy.wiki/index.php/How_To_Make_Commands This is a complete Roblox Lua script that references a brick, defines a function to toggle its transparency when touched, and connects the 'Touched' event to that function. ```Lua local brick = workspace.Brick -- Store a reference to the brick. local function onTouched(part) -- The function that runs when the part is touched. brick.Transparency = 1 wait(1) brick.Transparency = 0 end brick.Touched:connect(onTouched) -- The line that connects the function to the event. ``` -------------------------------- ### Complete Roblox Script Example Source: https://rbxlegacy.wiki/index.php/How_do_I_add_in_commands%3F This is a complete Roblox Lua script that references a brick, defines a function to toggle its transparency when touched, and connects the 'Touched' event to that function. ```Lua local brick = workspace.Brick -- Store a reference to the brick. local function onTouched(part) -- The function that runs when the part is touched. brick.Transparency = 1 wait(1) brick.Transparency = 0 end brick.Touched:connect(onTouched) -- The line that connects the function to the event. ``` -------------------------------- ### Basic Lua Scripting Outline Example Source: https://rbxlegacy.wiki/index.php/Talk%3ALessons An example of a simple outline for Lua scripting lessons, suggesting a progression from variables to types and expressions. ```text Lession 1: Variables Lession 2: Types Lession 3: Expressions ``` -------------------------------- ### Wiki Formatting: Example Template vs. Pre Tag Source: https://rbxlegacy.wiki/index.php/User_talk%3ANXTBoy Discusses the advantages of using wiki templates for code examples over the standard pre tag, focusing on clarity, presentation, and space efficiency. It highlights issues with excessive borders and margins when using example boxes for non-example code. ```WikiText Example ``` Things like this, which is just a way of taking a chunk of code, and making it take up too much space, with too many borders. Also, the margins look terrible. Ewww. ``` ``` -------------------------------- ### RBX.lua StarterGui Instance Methods Source: https://rbxlegacy.wiki/index.php/StarterGui Provides documentation for common instance methods available on the StarterGui service in RBX.lua. These methods allow for manipulation and retrieval of GUI elements and their properties. ```lua --- Returns a clone of the object and its children, unless its Archivable property is false. -- The clone will have the same properties as the original object and the same descendants (except those with an Archivable property set to false). -- The clone's Parent will be nil. -- Member of: Instance function Clone() end --- Returns the first child found with a name of name. -- Returns nil if no such child exists. -- If the optional recursive argument is true, will recursively descend the hierarchy while searching rather than only searching the immediate object. -- Member of: Instance function FindFirstChild(name, recursive) -- recursive defaults to false end --- Returns a read-only table of the object's children. -- Member of: Instance function GetChildren() return {} end --- Returns a coded string of the object's DebugId used internally by Roblox. -- Member of: Instance function GetDebugId() return "" end --- Returns a string with a dot (.) character separating a path of object hierarchy excluding "game". -- Member of: Instance function GetFullName() return "" end --- Returns true if the Instance is that class or a subclass. -- Member of: Instance function IsA(className) return false end --- Returns true if the object is an ancestor of _descendant_. -- Member of: Instance function IsAncestorOf(descendant) return false end --- Returns true if the object is a descendant of ancestor. -- Member of: Instance function IsDescendantOf(ancestor) return false end --- Sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children. -- Member of: Instance function Destroy() end --- Removes all descendants of the Instance, but leaves the Instance itself. -- Member of: Instance function ClearAllChildren() end ``` -------------------------------- ### Initialize Downloader Instance Source: https://rbxlegacy.wiki/index.php/User%3ATomtomn00/GRWS This code snippet demonstrates how to create a new instance of the Downloader class, preparing it for subsequent operations like setting the target URL and starting the download. ```JavaScript new Downloader(); ``` -------------------------------- ### Roblox Wiki: Sharper Images Guide Source: https://rbxlegacy.wiki/index.php/User_talk%3ABlocco A user asks about the progress of adding step 3 to the 'How To: Get Sharper Images' guide on the Roblox wiki. Another user confirms they will add it. ```Wiki Markup `Planning on adding step 3 to How To: Get Sharper Images any time soon?` ``` -------------------------------- ### Legacy Client Tutorials Source: https://rbxlegacy.wiki/index.php/Tutorials Guides focused on using legacy Roblox clients and related tools like Novetus and ORRH for development and hosting. -------------------------------- ### Lua Timer Usage Example Source: https://rbxlegacy.wiki/index.php/User%3ANXTBoy/Scripts/Timer This example demonstrates how to use the Timer class in Lua. It shows creating a Timer instance, starting, stopping, resuming, and printing the elapsed time. ```Lua local t = Timer.new() t:start() foo() t:stop() print(t:getTime()) t:resume() foo() print(t:getTime()) t:stop() ``` -------------------------------- ### Lua Table Formatting Examples Source: https://rbxlegacy.wiki/index.php/Lua_Style_Guide Provides examples of correct and incorrect formatting for Lua table literals, focusing on comma placement and spacing. It also shows the use of semicolons as separators within tables. ```Lua local data = {1,2,3} local data = {1, 2, 3} local data = { 1, 2, 3 } local data = { 1, 2, 3, } ``` ```Lua local data = { 1, 2, 3; 4, 5, 6; 7, 8, 9; } ``` -------------------------------- ### Create and Display BillboardGui with TextLabel in Lua Source: https://rbxlegacy.wiki/index.php/Beginner%27s_guide_to_GUI This script demonstrates how to create a BillboardGui and a TextLabel, parent them correctly, and attach the BillboardGui to the player's character head. It sets the size and text of the label and the size and offset of the BillboardGui. ```Lua game.Players.PlayerAdded:connect(function(Player) local f = Instance.new("TextLabel") local b = Instance.new("BillboardGui") f.Parent = b b.Parent = Player.PlayerGui f.Size = UDim2.new(0.5, 0, 0.5, 0) b.Size = UDim2.new(5, 0, 5, 0) b.StudsOffset = Vector3.new(0, 0, 0) f.Text = "Hello World" repeat wait() until Player.Character and Player.Character:findFirstChild("Head") b.Adornee = Player.Character.Head end) ``` -------------------------------- ### Lua Indentation Example Source: https://rbxlegacy.wiki/index.php/Lua_Style_Guide Demonstrates correct indentation for nested blocks in Lua, using a single tab per indentation level. This example shows a simple loop and print statement within conditional blocks. ```Lua local var = 10 if var > 0 do -- new block for i = 1, var do -- new block print(i) -- end block end -- end block end ``` -------------------------------- ### Get Current Coroutine Thread in Lua Source: https://rbxlegacy.wiki/index.php/Beginners_Guide_to_Coroutines The coroutine.running() function returns the current thread that is executing. The output is a hexadecimal memory address representing the coroutine. ```Lua new_thread=coroutine.create(function() print("hola") end) print(coroutine.running()) ``` -------------------------------- ### Lua Tutorial Outline Structure Source: https://rbxlegacy.wiki/index.php/User_talk%3AJulienDethurens/Guide This snippet outlines the hierarchical structure of a Lua tutorial, starting from basic scripting concepts like 'print' and 'variables' to more advanced topics such as 'metatables', 'coroutines', and the 'Roblox API'. It categorizes content into 'Pure Lua' and 'Lua and the Roblox API', with sub-sections for 'Starter', 'Intermediate', and 'Advanced' learning stages. ```Lua Map: Scripting Help Creating Scripts - Script Instance - Lua IDEs Pure Lua - Starter First Script - print - comments Variables - Assignment - Multiple assignment - local - Naming Data Types - Numbers - Strings - Booleans - Nil Expressions Operators - Arithmetic - Relational - Logical Statements Chunks and Blocks - More on local Conditional Statements - if - elseif - else Loops - Numeric For - While-Do - Repeat-Until - Break Functions - Arguments - Returning - multiple returns; relation to variables Tables - Construction - Indexing - Arrays - Dictionaries - Setting Indices Standard Libraries - string - math - table - Intermediate String Patterns More on Tables - keys: any type Generic For Operator Precedence Conditional assignment - Advanced Metatables Environments Coroutines goto (5.2) Lua and the Roblox API - Instances - Properties - Methods - Events - Callbacks - Roblox Data Types ``` -------------------------------- ### Setup Tooltips for Links Source: https://rbxlegacy.wiki/index.php/User%3ATomtomn00/GRWS Configures tooltips for links within a specified container. It handles both initial setup and removal of tooltips, with options to force re-setup or use specific popup data. Dependencies include helper functions like `defaultPopupsContainer` and `setupTooltipsLoop`. ```JavaScript function setupTooltips(container, remove, force, popData) { log('setupTooltips, container=' + container + ', remove=' + remove); if (!container) { if (getValueOf('popupOnEditSelection') && window.doSelectionPopup && document && document.editform && document.editform.wpTextbox1) { document.editform.wpTextbox1.onmouseup = doSelectionPopup; } container = defaultPopupsContainer(); } if (!remove && !force && container.ranSetupTooltipsAlready) { return; } container.ranSetupTooltipsAlready = !remove; var anchors; anchors = container.getElementsByTagName('A'); setupTooltipsLoop(anchors, 0, 250, 100, remove, popData); } function defaultPopupsContainer() { if (getValueOf('popupOnlyArticleLinks')) { return document.getElementById('mw_content') || document.getElementById('content') || document.getElementById('article') || document; } return document; } ``` -------------------------------- ### Lua Semicolon Usage Examples Source: https://rbxlegacy.wiki/index.php/Lua_Style_Guide Demonstrates correct and incorrect usage of semicolons in Lua for statement termination and table separation, highlighting where they are optional or disallowed. ```Lua local assignment = "value"; -- after assignments print("here"); -- after function calls return; -- at the end of 'break' or 'return' ``` -------------------------------- ### Roblox Lua: Print 'Hello world!' Source: https://rbxlegacy.wiki/index.php/User%3AJulienDethurens/Guide/Introduction This script uses the `print` function to display the text 'Hello world!' in the Roblox output window when the game is run. It's a fundamental example for beginners learning to script in Roblox. ```Lua print 'Hello world!' ``` -------------------------------- ### Set FloorWire WireRadius Source: https://rbxlegacy.wiki/index.php/FloorWire_Guide This code example sets the 'WireRadius' property of a FloorWire instance to customize its thickness, along with other properties like 'From', 'To', 'Color', and 'Transparency'. ```Lua FloorWire = Instance.new("FloorWire", game.Workspace) FloorWire.From = game.Workspace.PartA FloorWire.To = game.Workspace.PartB FloorWire.Color = BrickColor.new("Bright yellow") FloorWire.Transparency = 0.5 FloorWire.WireRadius = 1.5 ``` -------------------------------- ### Lua Short Comment Example Source: https://rbxlegacy.wiki/index.php/Comments_%28Scripting%29 Demonstrates the syntax for a single-line comment in Lua, which starts with a double hyphen and continues to the end of the line. This is ignored by the Lua parser. ```Lua -- This is a comment! ``` -------------------------------- ### Get Children of Game Elements Source: https://rbxlegacy.wiki/index.php/Talk%3ARobloxLocked_%28Property%29 Provides examples of retrieving all children of specific game elements (CoreGui.RobloxGui and Workspace) using the GetChildren() method in a script. ```Lua print( game.CoreGui.RobloxGui:GetChildren() ) --> s RobloxGui print( Workspace:GetChildren() ) --> table: xxxxx ``` -------------------------------- ### Create and Configure a Part Instance Source: https://rbxlegacy.wiki/index.php/Talk%3AInstance This script illustrates the creation of a 'Part' instance, parenting it to the workspace, setting its name to 'Brick', and assigning it a specific color using BrickColor.new(). ```Lua local p = Instance.new("Part") p.Parent = game.Workspace p.Name = "Brick" p.BrickColor = BrickColor.new(21) ``` -------------------------------- ### Adorn Torso with a SelectionBox GUI - Roblox Lua Source: https://rbxlegacy.wiki/index.php/Beginner%27s_guide_to_GUI This script creates a SelectionBox GUI and attaches it to the player's Torso when they join the game. It waits until the player's character and Torso are available before setting the Adornee property. ```Lua game.Players.PlayerAdded:connect(function(Player) local f = Instance.new("SelectionBox") local s = Instance.new("ScreenGui") f.Parent = s s.Parent = Player.PlayerGui repeat wait() until Player.Character and Player.Character:findFirstChild("Torso") f.Adornee = Player.Character.Torso end) ``` -------------------------------- ### Create a Frame GUI on Player Join - Roblox Lua Source: https://rbxlegacy.wiki/index.php/Beginner%27s_guide_to_GUI This script creates a Frame GUI and a ScreenGui when a player joins the game. The Frame is parented to the ScreenGui, which is then parented to the Player's PlayerGui. The Frame is centered and sized to half the screen. ```Lua game.Players.PlayerAdded:connect(function(Player) local f = Instance.new("Frame") local s = Instance.new("ScreenGui") f.Parent = s s.Parent = Player.PlayerGui f.Position = UDim2.new(0.5, 0, 0.5, 0) f.Size = UDim2.new(0.5, 0, 0.5, 0) end) ``` -------------------------------- ### Checking Coroutine Status in Lua Source: https://rbxlegacy.wiki/index.php/Beginners_Guide_to_Coroutines Shows how to use `coroutine.status()` to determine the current state of a coroutine (e.g., 'suspended', 'dead', 'running', 'normal'). The example checks the status before and after resuming a coroutine. ```Lua function core() print("hola") end new_thread=coroutine.create(core) print(coroutine.status(new_thread)) coroutine.resume(new_thread) print(coroutine.status(new_thread)) ``` -------------------------------- ### Start Article Preview Source: https://rbxlegacy.wiki/index.php/User%3ATomtomn00/GRWS Initiates an article preview by setting the redirect flag to 0 and calling the loadPreview function. ```JavaScript function startArticlePreview(article, oldid, navpop) { navpop.redir=0; loadPreview(article, oldid, navpop); } ``` -------------------------------- ### Coroutine with Parameters in Lua Source: https://rbxlegacy.wiki/index.php/Beginners_Guide_to_Coroutines Shows how to pass parameters to a coroutine's function during creation and how to resume it with arguments using `coroutine.resume`. The example calculates and prints a value based on the provided parameters. ```Lua local newThread = coroutine.create(function(a, b, c) print(a*b + c) end) coroutine.resume(newThread, 3, 5, 6) ``` -------------------------------- ### InfoStep Template Usage Example Source: https://rbxlegacy.wiki/index.php/User%3ABlocco/Sandbox/Templates/InfoStep Demonstrates the usage of the User:Blocco/Sandbox/Templates/InfoStep template with parameters for background color, border color, title, and a number. The output shows the rendered content 'TESTING' with the specified styling. ```Wiki Markup {{User:Blocco/Sandbox/Templates/InfoStep| bkcolor=red| bdcolor=red| title=test| number=1}}TESTING ``` -------------------------------- ### Lua Length Operator '#' Examples Source: https://rbxlegacy.wiki/index.php/User%3ACrazypotato4/Test Illustrates the use of the '#' operator in Lua to get the length of strings and tables. For strings, it returns the number of characters. For tables, it returns the highest numeric index. ```Lua print( #"hello" ) print( #{ "potato", false, { "q", "lol" }, 42 } ) ``` -------------------------------- ### InstaView configuration setup Source: https://rbxlegacy.wiki/index.php/User%3ATomtomn00/GRWS Sets up the configuration object for InstaView, a Mediawiki to HTML converter. It defines base URLs, user details, wiki-specific settings, and paths for various resources like images and math. ```JavaScript function setupLivePreview() { // options Insta.conf = { baseUrl: '', user: {}, wiki: { lang: pg.wiki.lang, interwiki: pg.wiki.interwiki, default_thumb_width: 180 }, paths: { articles: pg.wiki.articlePath + '/', // Only used for Insta previews with images. (not in popups) math: '/math/', images: '//upload.wikimedia.org/wikipedia/en/', // FIXME ( window.getImageUrlStart ? getImageUrlStart(pg.wiki.hostname) : ''), images_fallback: '//upload.wikimedia.org/wikipedia/commons/', magnify_icon: 'skins/common/images/magnify-clip.png' }, locale: { user: mw.config.get('wgFormattedNamespaces')[pg.nsUserId], image: mw.config.get('wgFormattedNamespaces')[pg.nsImageId], category: mw.config.get('wgFormattedNamespaces')[pg.nsCategoryId], // shouldn't be used in popup previews, i think months: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] } } // options with default values or backreferences with (Insta.conf) { user.name = user.name || 'Wikipedian' user.signature = '[['+locale.user+':'+user.name+'|'+user.name+']]' //paths.images = '//upload.wikimedia.org/wikipedia/' + wiki.lang + '/' } // define constants ``` -------------------------------- ### Roblox Lua gcinfo Function Example Source: https://rbxlegacy.wiki/index.php/Print Shows the usage of the deprecated gcinfo function in Roblox Lua to get the amount of dynamic memory in use. It also demonstrates the modern alternative, collectgarbage('count'). ```Lua print (gcinfo ()) a=collectgarbage ("count") print(a) ``` -------------------------------- ### Lua NetworkServer Object Link Source: https://rbxlegacy.wiki/index.php/Special%3AWhatLinksHere/Start_%28Method%29 This entry represents a link from the RBX.lua.NetworkServer object to the 'Start (Method)' page. It indicates a dependency or reference within the Lua scripting environment of RBXLegacy. ```Lua RBX.lua.NetworkServer (Object) (transclusion) (← links) ``` -------------------------------- ### Handle Wiki Downloads and Previews Source: https://rbxlegacy.wiki/index.php/User%3ATomtomn00/GRWS Manages download data, handles redirects, and inserts article previews into the wiki. It includes logic for lazy loading previews and displaying raw template content. ```JavaScript var redirMatch = pg.re.redirect.exec(download.data); if (download.owner.redir===0 && redirMatch) { completedNavpopTask(download.owner); loadPreviewFromRedir(redirMatch, download.owner); return; } if (download.owner.visible || !getValueOf('popupLazyPreviews')) { insertPreviewNow(download); } else { var id=(download.owner.redir) ? 'PREVIEW_REDIR_HOOK' : 'PREVIEW_HOOK'; download.owner.addHook( function(){insertPreviewNow(download); return true;}, 'unhide', 'after', id ); } } function insertPreviewNow(download) { if (!download.owner) { return; } var wikiText=download.data; var navpop=download.owner; completedNavpopTask(navpop); var art=navpop.redirTarget || navpop.originalArticle; // makeFixDabs(wikiText, navpop); if (getValueOf('popupSummaryData') && window.getPageInfo) { var info=getPageInfo(wikiText, download); setPopupTrailer(getPageInfo(wikiText, download), navpop.idNumber); } var imagePage=_;_ if (art.namespaceId()==pg.nsImageId) { imagePage=art.toString(); } else { imagePage=getValidImageFromWikiText(wikiText); } if(imagePage) { loadImage(Title.fromWikiText(imagePage), navpop); } // if (getValueOf('popupPreviews')) { insertArticlePreview(download, art, navpop); } } function insertArticlePreview(download, art, navpop) { if (download && typeof download.data == typeof _){_ if (art.namespaceId()==pg.nsTemplateId && getValueOf('popupPreviewRawTemplates')) { // FIXME compare/consolidate with diff escaping code for wikitext var h='\n* * *\n`' + download.data.entify().split('\n').join(' \n') + '`'; setPopupHTML(h, 'popupPreview', navpop.idNumber); } else { var p=prepPreviewmaker(download.data, art, navpop); p.showPreview(); } } } function prepPreviewmaker(data, article, navpop) { // deal with tricksy anchors var d=anchorize(data, article.anchorString()); var urlBase=joinPath([pg.wiki.articlebase, article.urlString()]); var p=new Previewmaker(d, urlBase, navpop); return p; } ``` -------------------------------- ### Get User Categories in Lua Source: https://rbxlegacy.wiki/index.php/GetUserCategories_%28Method%29 Retrieves and iterates through the categories associated with a given user ID using the InsertService. This example demonstrates how to access user category data and print its details. ```Lua local categories = Game:GetService("InsertService"):GetUserCategories(player.userId) for ndx,catinfo in ipairs( categories ) do print( ndx ) for k,v in pairs(catinfo) do print( k, "=", v ) end end ``` -------------------------------- ### Define and Call a Lua Function Source: https://rbxlegacy.wiki/index.php/Absolute_beginner%27s_guide_to_scripting Demonstrates how to define a simple Lua function that accepts a parameter and prints a greeting. It also shows how to call this function with an argument. ```Lua local function sayHello(name) print("Hello, " .. name .. "!") end sayHello("Bob") ``` -------------------------------- ### String Manipulation with string.sub in Lua Source: https://rbxlegacy.wiki/index.php/How_To%3A_Admin_Commands Demonstrates how to use the `string.sub` function in Lua to extract substrings from a given string. It shows examples of extracting a specific range of characters and extracting from a start position to the end of the string. ```Lua local exampleString = "OBF" local newExampleString = exampleString:sub(1, 2) print(newExampleString) --> OB newExampleString = exampleString:sub(2) print(newExampleString) --> BF ``` -------------------------------- ### Log Entry Example - RBXLegacy Wiki Source: https://rbxlegacy.wiki/index.php/Special%3ALog/MediaWiki_default An example of a log entry showing a page creation event, including the timestamp, user, action, and associated tags. This demonstrates the format of recorded events. ```HTML * 04:30, 24 December 2022 MediaWiki default talk contribs created page Main Page Tag: Reverted ``` -------------------------------- ### Lua String Manipulation: Get ASCII Values Source: https://rbxlegacy.wiki/index.php/Function_Dump/String_Manipulation Returns the ASCII values of characters within a specified range of a string. The first character is at position 1. Optional arguments define the start and end indices for the range. ```Lua print( string.byte("d") ) print( string.byte("abc", 1, 3) ) ``` -------------------------------- ### Define and Call a Lua Function Source: https://rbxlegacy.wiki/index.php/How_To_Make_Commands Demonstrates how to define a simple Lua function that accepts a parameter and prints a greeting. It also shows how to call this function with an argument. ```Lua local function sayHello(name) print("Hello, " .. name .. "!") end sayHello("Bob") ``` -------------------------------- ### Lua While Loop with Wait Source: https://rbxlegacy.wiki/index.php/How_To_Make_Commands Provides an example of a Lua 'while' loop that runs indefinitely as long as the condition is true. It includes a 'wait()' function to prevent server crashes due to excessive processing. ```Lua while true do print("Lagging up your computer...") wait(0.5) end ``` -------------------------------- ### Game Control - Play Source: https://rbxlegacy.wiki/index.php/Studio Starts running the place. This action is initiated by clicking the 'Play' button. -------------------------------- ### Lua While Loop with Wait Source: https://rbxlegacy.wiki/index.php/How_do_I_add_in_commands%3F Provides an example of a Lua 'while' loop that runs indefinitely as long as the condition is true. It includes a 'wait()' function to prevent server crashes due to excessive processing. ```Lua while true do print("Lagging up your computer...") wait(0.5) end ``` -------------------------------- ### Create Script Tutorial Box Source: https://rbxlegacy.wiki/index.php/Template%3AScriptTutorial This template creates a box to indicate a tutorial. The first argument specifies the difficulty (e.g., 'Hard'), and the second argument specifies the related topic (e.g., 'Building'). ```Wiki Markup {{ScriptTutorial| First argument is difficulty |Second argument is what it's related to. }} ``` ```Wiki Markup {{ScriptTutorial|Hard|Building}} ``` -------------------------------- ### Concurrent Coroutine Execution for Timed Updates in Lua Source: https://rbxlegacy.wiki/index.php/Beginners_Guide_to_Coroutines This example uses `coroutine.wrap` to run two coroutines concurrently, each updating a UI element (Hint and Message) at different intervals. This showcases coroutines for managing simultaneous, time-based operations. ```Lua local h = Instance.new("Hint", workspace); local m = Instance.new("Message", workspace); local changeHint = coroutine.wrap(function() for i = 60, 0, -1 do wait(0.5) h.Text = i end end) local changeMessage = coroutine.wrap(function() for i = 60, 0, -1 do wait(1) m.Text = i end end) changeHint() changeMessage() ``` -------------------------------- ### Define and Call a Lua Function Source: https://rbxlegacy.wiki/index.php/How_do_I_add_in_commands%3F Demonstrates how to define a simple Lua function that accepts a parameter and prints a greeting. It also shows how to call this function with an argument. ```Lua local function sayHello(name) print("Hello, " .. name .. "!") end sayHello("Bob") ``` -------------------------------- ### Track Mouse Movement on a Frame GUI - Roblox Lua Source: https://rbxlegacy.wiki/index.php/Beginner%27s_guide_to_GUI This script extends the previous example by adding a MouseMoved event listener to the Frame GUI. It prints the mouse coordinates whenever the mouse moves over the frame. ```Lua game.Players.PlayerAdded:connect(function(Player) local f = Instance.new("Frame") local s = Instance.new("ScreenGui") f.Parent = s s.Parent = Player.PlayerGui f.Position = UDim2.new(0.5, 0, 0.5, 0) f.Size = UDim2.new(0.5, 0, 0.5, 0) f.MouseMoved:connect(function(x, y) print("Mouse moved to: ", x," " ,y) end) end) ``` -------------------------------- ### Roblox Building Tutorials Source: https://rbxlegacy.wiki/index.php/Tutorials Guides on creating and modifying game environments in Roblox. Covers essential building techniques like manipulating bricks, applying materials, and setting up game elements. ```Roblox Studio -- How to Make Bricks You Can Walk Through -- Use the Properties window to set CanCollide to false for a brick. -- Example: Selecting a part and changing its property -- local part = game.Workspace.Part1 -- part.CanCollide = false ``` ```Roblox Studio -- How to make Transparent Bricks -- Use the Properties window to adjust the Transparency property (0 is opaque, 1 is fully transparent). -- Example: Making a brick transparent -- local transparentBrick = game.Workspace.Brick -- transparentBrick.Transparency = 0.5 ``` ```Roblox Studio -- How to Change Materials -- Use the Properties window to select different materials for your bricks. -- Example: Changing a brick's material to Wood -- local woodBrick = game.Workspace.Brick -- woodBrick.Material = Enum.Material.Wood ``` ```Roblox Studio -- How to Make a Door -- Typically involves scripting to handle opening and closing. -- Example: Basic door script concept (requires more setup) -- local door = game.Workspace.Door -- local isOpen = false -- function toggleDoor() -- if isOpen then -- door.Transparency = 0 -- isOpen = false -- else -- door.Transparency = 1 -- isOpen = true -- end -- end ``` ```Roblox Studio -- How to Make Text on a Brick -- Use the SurfaceGui and TextLabel objects. -- Example: Adding text to a brick's surface -- local brick = game.Workspace.TextBrick -- local surfaceGui = Instance.new("SurfaceGui") -- surfaceGui.Parent = brick -- local textLabel = Instance.new("TextLabel") -- textLabel.Text = "Hello!" -- textLabel.Parent = surfaceGui ``` ```Roblox Studio -- How to Make Conveyor Belts -- Use the Velocity property of a script or a BodyVelocity object. -- Example: Applying velocity to a part -- local conveyor = game.Workspace.ConveyorBelt -- local velocity = Instance.new("BodyVelocity") -- velocity.Velocity = Vector3.new(0, 0, 10) -- Move along Z-axis -- velocity.MaxForce = Vector3.new(5000, 0, 5000) -- velocity.Parent = conveyor ``` ```Roblox Studio -- How to Make a Trampoline -- Use BodyVelocity or apply an upward force when a player touches it. -- Example: Basic trampoline concept -- local trampoline = game.Workspace.Trampoline -- trampoline.Touched:Connect(function(hit) -- local character = hit.Parent -- if character:FindFirstChild("Humanoid") then -- local humanoid = character.Humanoid -- humanoid.JumpPower = 50 -- Increase jump power -- end -- end) ``` ```Roblox Studio -- CFraming -- Used for precise positioning and rotation of parts. -- Example: Rotating a part 90 degrees on the Y-axis -- local partToRotate = game.Workspace.Part -- partToRotate.CFrame = partToRotate.CFrame * CFrame.Angles(0, math.rad(90), 0) ``` ```Roblox Studio -- How to Make a Car -- Requires VehicleSeat, Wheels, and potentially BodyVelocity/AlignPosition. -- Example: Basic car setup (simplified) -- local carSeat = game.Workspace.CarSeat -- local wheel = game.Workspace.Wheel -- -- Attach wheels and configure seat properties ``` -------------------------------- ### Lua While Loop with Wait Source: https://rbxlegacy.wiki/index.php/Absolute_beginner%27s_guide_to_scripting Provides an example of a Lua 'while' loop that runs indefinitely as long as the condition is true. It includes a 'wait()' function to prevent server crashes due to excessive processing. ```Lua while true do print("Lagging up your computer...") wait(0.5) end ``` -------------------------------- ### Building Tutorials: Scripting Examples Source: https://rbxlegacy.wiki/index.php/User_talk%3AMindraker/Archive2 This snippet provides examples of scripting concepts for building tutorials on the RBXLegacy wiki. It covers making water, floating effects, acid, and waves, along with general concepts and pre-made models. ```Wiki Markup Making models of things (e.g. tall building) and applying scripting to it. Concepts, usage, and models already made are accepted. For example: * How to make water. * Scripts for floating. * Making Acid. * Waves. * etc. ``` -------------------------------- ### Anim8or Export Script Setup Source: https://rbxlegacy.wiki/index.php/Making_Hats/Anim8or_Mesh_Exporter This section guides users on how to set up the Anim8or export script. It involves saving the script with a .a8s extension and configuring Anim8or to recognize and preload it. The process is detailed for Notepad and the Anim8or interface. ```Roblox Script /* This script is for exporting meshes from Anim8or to the Roblox .mesh format. It was created by Gamer3D. Instructions: 1. Save this script as an .a8s file (e.g., anim8or_export.a8s). 2. In Anim8or, go to File > Configure... > Scripts. 3. Click the '...' button next to Scripts and select your .a8s file. 4. Check the 'Preload Scripts' box and click OK. 5. Close and reopen Anim8or. A success message should appear in the 'Anim8or Debug Output' window. This script handles mesh export, including vertex data, face data, and UV coordinates. It is designed to be compatible with the Roblox engine. */ --[[ Configuration --]] local exportFileName = "mesh.mesh" --[[ Main Export Function --]] function ExportMesh() local mesh = Anim8or.GetSelectedMesh() if not mesh then Anim8or.Log("No mesh selected.") return end local file = io.open(exportFileName, "w") if not file then Anim8or.Log("Failed to open file for writing: " .. exportFileName) return end -- Write header file:write("version 1\n") -- Write vertices local vertices = mesh:GetVertices() for i, v in ipairs(vertices) do file:write(string.format("v %.6f %.6f %.6f\n", v.x, v.y, v.z)) end -- Write texture coordinates (UVs) local uvs = mesh:GetUVs() for i, uv in ipairs(uvs) do file:write(string.format("vt %.6f %.6f\n", uv.u, uv.v)) end -- Write faces (triangles) local faces = mesh:GetFaces() for i, f in ipairs(faces) do -- Assuming faces are triangles and vertex indices are 1-based file:write(string.format("f %d/%d %d/%d %d/%d\n", f.v1, f.uv1, f.v2, f.uv2, f.v3, f.uv3)) end file:close() Anim8or.Log("Mesh exported successfully to " .. exportFileName) end --[[ Register the export command --]] Anim8or.RegisterCommand("ExportRobloxMesh", ExportMesh) --[[ Example of how to call the export function (e.g., via a button or menu item) --]] -- Anim8or.RunCommand("ExportRobloxMesh") --[[ Debug output simulation --]] -- Anim8or.Log("Compiling \"C:\\Users\\file\\anim8or_export.a8s\":\n61 lines 0 errors") --[[ End of script --]] $result=1; ``` -------------------------------- ### Create and Position a Frame GUI - Roblox Lua Source: https://rbxlegacy.wiki/index.php/Beginner%27s_guide_to_GUI This script creates a Frame GUI, positions it in the center of the screen, and sets its size to half the screen's dimensions. It utilizes the UDim2 object for positioning and sizing. ```Lua local r = Instance.new("Frame") r.Position = UDim2.new(.5, 0, .5, 0) r.Size = UDim2.new(.5, 0, .5, 0) ``` -------------------------------- ### AddCoreScript Example for Script/LocalScript Source: https://rbxlegacy.wiki/index.php/AddCoreScript_%28Method%29 This example shows the usage of the AddCoreScript method when called from a regular Script or LocalScript. It functions similarly to the Command Bar example, creating a CoreScript with the provided asset ID, parent, and name. ```Lua game[ "Script Context" ]:AddCoreScript( 37801172, game.Players, "StarterScript" ) -- s AddCoreScript ``` -------------------------------- ### Create Roblox Plugin with Toolbar and Button Source: https://rbxlegacy.wiki/index.php/Add_Ons This snippet demonstrates the fundamental steps to create a Roblox plugin. It initializes a plugin instance, creates a toolbar, and then adds a button to that toolbar. The button is configured with hover text and an associated icon file. Finally, it connects a function to the button's Click event, which prints 'Hello, World!' to the output when the button is pressed. ```Lua local plugin = PluginManager():CreatePlugin() local toolbar = plugin:CreateToolbar("Hello World Plugin") local button = toolbar:CreateButton("", "Click this button to print Hello World!", "IconName.png") button.Click:connect(function() print("Hello, World!") end) ```