How to change names by Scripting / Level : Beginner


  • So, if you're new to scripting and do NOT know how to program "lua" at ALL, then read this text to learn some parts of the basics.

    -- WARNING: THIS MAY BE A LITTLE TRICKY --

    Commands/specific addons that are included in this tutorial:

    • print

    • game

    • name

    • local

    • return

    Script type you'll need:

    • Regular Script (Class Name: Script)

    So, you will have to make a local variable for what object you want to name.

    local obj = game.Workspace.random
    

    Replace the "game.Workspace.random" with what object address the object is
    Now, you will have to send a specific addon.

    local obj = game.Workspace.random
    
    obj.Name = "NPC"
    

    You can also replace "NPC" with whatever you want. IMPORTANT: QUOTATION MARKS MUST BE BESIDE THE PARAGRAPH/SENTENCE/WORD
    Final touch, returning the variable so it can work properly.

    local obj = game.Workspace.random
    
    obj.Name = "NPC"
    
    return obj
    

    And you are done!


  • @CrastificeDude612 This is not really how it works. You cannot return while you are not in a function or a module script. Also, please spell it "Lua" as it is a proper noun, and remove the quotes.

Log in to reply
 

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.