A good way to master scripting.

  • If you want to learn how to LUA follow these steps

    If you want to learn how to master scripting you have to start small. So i'm going to teach you how you should start.
    The first game you should start working on is an obby. but lets start in the basics.
    To find an object in explorer you have to start with game
    Why game?
    game is just to tell that its on the game. Like explorer is the whole game.
    Why workspace?
    It doesn't have to be work space it can be all the columns in explorer like "starter Gui" or "Starter player"

    That is the first script you should learn. To start knowing more go to the roblox wiki's.

    Ok now back to the obby's.
    So start by trying to make a kill brick over and over in till you remember it.

    function onTouch(part)
    local human = part.Parent:findFirstChild("Humanoid")
    if (human == nil) then return end
    human.Health = 0

    Now start trying to make that over and over in till you remember it and remember there meanings.
    NOTE:it will not work if you keep looking back at the script i gave you.
    After you mastered that try to remember how to make a checkpoint script

    	local spawn = script.Parent

    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
    if not checkpointData then
    checkpointData = Instance.new("Model", game.ServerStorage)
    checkpointData.Name = "CheckpointData"

    	local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
    	if not checkpoint then
    		checkpoint = Instance.new("ObjectValue", checkpointData)
    		checkpoint.Name = tostring(player.userId)
    			character:WaitForChild("HumanoidRootPart").CFrame = game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
    	checkpoint.Value = spawn


    I know this a little harder but if you want to learn you have to remember how to make it and know there meanings.

    When you have mastered that you need to make an obby then keep on making more and more and without copying the spawns and kill bricks you have to script each one.

  • There are a few problems with this post, so let me point out the important ones.

    alt text

    • You shouldn't start with an obby. You should start small, but limiting yourself to only an obby is bad. To learn the language well, I highly recommend making something creative and original.

    • Don't use game.workspace, use workspace or game.Workspace.

    • Your answer to the question "Why workspace" doesn't answer the question, nor make much sense.

    • Making something over and over helps you learn, sure, but forcing yourself to do the same thing over and over is very bad. Once you make something, you shouldn't feel urged to re-type that in the future, as long as you have a reference to it. Plus, you should improve yourself, and try new things instead of repeating the same thing over and over.

    • Your code is really bad. It's bad because:
      1.) You're not using a local function
      2.) You're using connect instead of Connect
      3.) You're using findFirstChild instead of FindFirstChild
      4.) You're checking if something is nil, which isn't necessary.
      5.) You're not checking if players' characters touch the brick, but instead if anything with a humanoid touched the brick.
      6.) This code assumes the script is inside the part, which isn't bad, but it's not good.

    I would change the kill brick to something like this:

    --// Services
    local Players = game:GetService("Players")
    --// Workspace Variables
    local killbrick = workspace:WaitForChild("KillBrick") -- define kill bricks
    -- NOTE: It would be better to maybe loop though a folder of kill bricks or something instead, but this is just an example.
          hit.Parent:BreakJoints() -- fun
    • Again, repeating something over and over isn't good for understanding how something works necessarily. It would be better to experiment with the code instead of re-create it.

    • For the last thing, I don't want to bother going over the code, but in this code you're using completely different methods than the first, which makes this look like an obvious free model. You don't even go over the code, so this doesn't really teach anyone anything. Also, it's not good to name a variable spawn, because spawn is already a function in Lua.

    I don't think it's bad that you're trying to help people, but because you're in my discord server I know you don't know much about Lua, and I don't think you should try to teach others how to learn Lua if you don't know Lua yourself.

Log in to reply

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