tech/game

21/07/20 AlvinBlox - 2020 Beginner Roblox Scripting Tutorials #1

tech-lover 2021. 7. 20. 17:06

Roblox How To Code - How To Script On Roblox - Episode 1

https://youtu.be/BfLUt3mfJiY

CTRL+I : Insert Opject

- Script.lua

```

game.Workspace.Hello.Transparency = 0.5

game.Workspace.Hello.Material = Enum.Material.Wood

game.Workspace.Hello.BrickColor = BrickColor.new("Really Red")

game.Workspace.Hello.Color = Color3.fromRGB(255,15737)

game.Workspace.Hello.Anchored = true

```

Beginner Roblox Scripting Tutorial 2 - Referencing & More Properties

https://youtu.be/_K7stCkqFBYdd

Beginner Roblox Scripting Tutorial 3 - Dice Game (Properties,Referencing Part 2]

https://youtu.be/jugxDNrrdRY

```

-- tutorial 01

game.Workspace.Hello.Transparency = 0.5

game.Workspace.Hello.Material = Enum.Material.Wood

game.Workspace.Hello.BrickColor = BrickColor.new("Really Red")

game.Workspace.Hello.Color = Color3.fromRGB(255,15737)

game.Workspace.Hello.Anchored = true

 

-- tutorial 02

-- game.Workspace.My Brick.Transparency = 1 -- ERROR SPACE

--game.Workspace.56.Transparency = 1 -- ERROR Number

game.Workspace["My Brick"].Transparency = 1 -- OK

 

-- tutorial 03 - Dice Game

-- Workspace>gravity : 500 

game.Workspace.MyDice1.Anchored = false -- roll first die

wait(0.5)

game.Workspace.MyDice2.Anchored = false -- role second die

```

Beginner Roblox Scripting Tutorial 4 - Variables

https://youtu.be/NOLxgJnFahE

CTRL+G : Group

Double Group (Cascaded Group)

 

Instance.new() - Instancing tutorial - Roblox beginner scripting #5

https://youtu.be/ivqeeFwcixg

Roblox Beginner Scripting - Functions (Ep 6)

https://youtu.be/1G2yXTxYM-8

Function Parameters / Arguments - Roblox Beginner Scripting #7

https://youtu.be/bkp3OBs0oV0

Returning - Beginner Roblox Scripting Tutorial #8

https://youtu.be/CrqSDVXaDhc

Built In Functions - Roblox Scripting for Beginners #9

https://youtu.be/Z1YjUcAYy7w

 

```

-- tutorial 01

game.Workspace.Hello.Transparency = 0.5

game.Workspace.Hello.Material = Enum.Material.Wood

game.Workspace.Hello.BrickColor = BrickColor.new("Really Red")

game.Workspace.Hello.Color = Color3.fromRGB(255,15737)

game.Workspace.Hello.Anchored = true

 

-- tutorial 02

-- game.Workspace.My Brick.Transparency = 1 -- ERROR SPACE

--game.Workspace.56.Transparency = 1 -- ERROR Number

game.Workspace["My Brick"].Transparency = 1 -- OK

 

-- tutorial 03 - Dice Game

-- Workspace>gravity : 500 

-- game.Workspace.MyDice1.Anchored = false -- roll first die

-- wait(0.5)

-- game.Workspace.MyDice2.Anchored = false -- role second die

 

-- tutorial 04 - Variables

wait(10)

game.Workspace.GameParts.MyDice.MyDice1.Anchored = false -- roll first die

wait(1)

game.Workspace.GameParts.MyDice.MyDice2.Anchored = false -- roll first die

game.Workspace.GameParts.MyDice.MyDice2.BrickColor = BrickColor.new("Really red")

 

-- 1

local MyDice = game.Workspace.GameParts.MyDice

 

MyDice.MyDice1.Anchored = false -- roll first die

wait(1)

MyDice.MyDice2.Anchored = false -- roll first die

MyDice.MyDice2.BrickColor = BrickColor.new("Really red")

 

-- 2

local MyDice1 = game.Workspace.GameParts.MyDice.MyDice1

local MyDice2 = game.Workspace.GameParts.MyDice.MyDice2

 

MyDice1.Anchored = false -- roll first die

wait(1)

MyDice2.Anchored = false -- roll first die

 

MyDice1.BrickColor = BrickColor.new("Really red")

MyDice2.BrickColor = BrickColor.new("Really red")

 

-- tutorial 05 - Instance.new()

local myPart = Instance.new("Part", game.Workspace)

myPart.Transparency = 0.5

myPart.Anchored = true

myPart.Position = Vector3.new(5,5,5)

 

myPart.Parent = game.Workspace

 

-- Scripting Tutorial #06

-- 1 

local part = Instance.new("Part")

part.Name = "MyAwesomePart"

part.BrickColor = BrickColor.new("really red")

part.Anchored = true

part.Position = Vector3.new(0,15,0)

part.Transparency = 0.5

part.Reflectance = 0.6

part.CanCollide = false

part.Parent = workspace

 

local part = Instance.new("Part")

part.Name = "MyAwesomePart"

part.BrickColor = BrickColor.new("really red")

part.Anchored = true

part.Position = Vector3.new(0,15,0)

part.Transparency = 0.5

part.Reflectance = 0.6

part.CanCollide = false

part.Parent = workspace

 

local part = Instance.new("Part")

part.Name = "MyAwesomePart"

part.BrickColor = BrickColor.new("really red")

part.Anchored = true

part.Position = Vector3.new(0,15,0)

part.Transparency = 0.5

part.Reflectance = 0.6

part.CanCollide = false

part.Parent = workspace

 

local part = Instance.new("Part")

part.Name = "MyAwesomePart"

part.BrickColor = BrickColor.new("really red")

part.Anchored = true

part.Position = Vector3.new(0,15,0)

part.Transparency = 0.5

part.Reflectance = 0.6

part.CanCollide = false

part.Parent = workspace

 

local part = Instance.new("Part")

part.Name = "MyAwesomePart"

part.BrickColor = BrickColor.new("really red")

part.Anchored = true

part.Position = Vector3.new(0,15,0)

part.Transparency = 0.5

part.Reflectance = 0.6

part.CanCollide = false

part.Parent = workspace



-- 2 Functions

function generatePart1()

    local part = Instance.new("Part")

    part.Name = "MyAwesomePart"

    part.BrickColor = BrickColor.new("really red")

    part.Anchored = true

    part.Position = Vector3.new(0,15,0)

    part.Transparency = 0.5

    part.Reflectance = 0.6

    part.CanCollide = false

    part.Parent = workspace

end

 

generatePart1()

generatePart1()

generatePart1()

generatePart1()

generatePart1()



-- Scripting Tutorial #07 : Parameters / Arguments

function generatePart2(name)

    local part = Instance.new("Part")

    part.Name = name

    part.BrickColor = BrickColor.new("really red")

    part.Anchored = true

    part.Position = Vector3.new(0,15,0)

    part.Transparency = 0.5

    part.Reflectance = 0.6

    part.CanCollide = false

    part.Parent = workspace

end

 

generatePart2("PartNumberOne")

generatePart2("jjdjjd")

generatePart2("kjdakj")

generatePart2("jdjdj")

generatePart2("jjjjfj")

 

function generatePart3(nameisAnchoredreflectance)

    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.Transparency = 0.5

    part.Reflectance = reflectance

    part.CanCollide = true

    part.Parent = workspace

end

 

generatePart3("Hamburger"true1)

 

function printText(stringToPrint

    print(stringToPrint)

end

 

printText("Hell there!!")

wait(5)

printText("This is a message")

 

-- Scripting Tutorial #08 : Returning

 

function addNumbers(number1number2)

    local result = number1 + number2

    return result

end

 

local calculationResult = addNumbers(35-- 8

print(calculationResult * 10)

 

function createPart(transparencycoloranchored)

    local part = Instance.new("Part")

    part.Transparency = transparency

    part.Color = color

    part.Anchored = anchored

    part.Parent = workspace

 

    return part

end

 

local myReturnedPart = createPart(0.5, Color3.fromRGB(25500), true)

myReturnedPart.Color = Color3.fromRGB(02550)

 

-- Scripting Tutorial #09 : Built In Functions

-- Destroy()

-- Clone()

-- ClearAllChildren()

-- wait()

-- print()

 

game.Workspace.Part:Destroy()

 

local myClone = game.Workspace.Part:Clone()

myClone.Parent = game.Workspace

 

wait(10)

 

game.Workspace.Part:ClearAllChildren()

print(5643)

 

```