Roblox Studio Tutorials/Beginning to script

Oops. I forgot to tell you to go to models, then use the anchor tool to anchor everything. Do it right now. I apologize for that. But anyways, we are going to start scripting today! The first thing we are going to script is lava. Insert a new part then rename it "Lava" by clicking on its name, delete its current name, and type in "Lava". Now click on the plus sign on the right side of lava. search "Script" and click on script. Now type this in the script:

local LavaPart = script.Parent

local function onPartTouch(otherPart)

       local partParent = otherPart.Parent
       local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")

       if ( Humanoid ) then
             humanoid.Health = 0

Test it by touching the lava. If you died, then the script is working. The other thing we are going to script is a conveyor that pushes players off. Make a new part and insert another script inside this one. Put the following script inside: while wait() do script.Parent.Velocity=script.Parent. CFrame.lookVector*10 Change 10 to how fast you want the player to move on it. Don't forget to anchor everything!