Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Who wants a tutorial script? Here it is : (This is script number 1)

Asked by 5 years ago
Edited 5 years ago
--[[ Welcome to my begginer script!
    You may take what ever you need.

    SharkOwen09 --]]


-- 1: Making code shorter (Using "LOCAL" (Varabie = local) --

-- Varabies --
local light1 = game.Workspace.GameParts.Light1
local light2 = game.Workspace.GameParts.Light2

-- Effects --
light1.PointLight.Range = 0
light2.PointLight.Range = 0

-- 2+3+4: Adding a part + looping + Parameters / Arguments --

function generatepart(name,isAnchored,Trans)
    local part = Instance.new("Part")
    part.Name = name
    part.BrickColor = BrickColor.new("Really red")
    part.Anchored = isAnchored
    part.Position = Vector3.new(0,15,0)
    part.Size = Vector3.new(5,5,5)
    part.Parent = workspace
    part.Transparency = Trans
end


generatepart("PartNumberOne",true,0)
generatepart("PartNumberTwo",false,0.3)

-- Examp 2 (YOU NEED OUTPUT TO SEE THESE MESSAGES) --
function printText(STP)
    print(STP)
end

printText("100x100 is 10,000")
printText("100x100 is not 27,928")

-- 5: Returning (It stops function)--

function addNumbers(number1,number2)
    local result = number1+number2
    return result
end

local calculateResult = addNumbers(8,5) -- 13
print(calculateResult*89) -- Now 1,157 --

-- Examp 2 --

function CP(trans,color,anchor)
    local part = Instance.new("Part")
    part.Transparency = trans
    part.Color = color
    part.Anchored = anchor
    part.Parent = workspace

    return part
end

local MRP = CP(0.5,Color3.fromRGB(255,0,0),true)
MRP.Color = Color3.fromRGB(0,255,0)

-- Final: Built in functions
-- Clone --
local myClone = game.Workspace.GameParts.Light1:Clone()
myClone.parent = game.Workspace

-- ClearAllChildren --

game.Workspace.GameParts.Light1:ClearAllChildren()

-- you should know how to use destroy,wait, and print --
1
This script, you need a model named 'GameParts' w/ two parts named 'light1 , light2' SharkOwen_dev 69 — 5y
0
You're supposed to ask the members of the forum a QUESTION not some tutorial! rabbi99 714 — 5y
0
A. This is not a question. B. This is a terrible tutorial. C. Delete this. User#29813 0 — 5y
0
It’s a thing for beginners SharkOwen_dev 69 — 5y
View all comments (2 more)
0
this looks cool 123nabilben123 499 — 5y
0
Delete it please this is not a question. antoniorigo4 117 — 5y

Answer this question