Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Created by: Krenodavid_Windows
- v.1.0
- About:
- This is a script, published on Pastebin.com.
- I Created this to help people learn LUA Coding in Roblox.
- Maybe you already knew these, maybe not. I'm gonna explain you what I Know and how it works.
- --]]
- -- First, let's get started with Variables.
- -- A Basic variable looks like this:
- local Example = 1 -- Syntax: local <Name> = <Value>
- -- Variables, can be created with other values too. For example here is a Boolean (Text Only) Value.
- local ExampleBoolean = "Example" -- Syntax: local <Name> = <"Text Value">
- -- You can have variables what are storing a Service, A New part (Instance.new()) etc.
- local RepFirst = game:GetService("ReplicatedFirst") -- This mostly helps you, in faster scripting.
- -- What it does is it lets you to short things. Example: RepFirst = game:GetService("ReplicatedFirst")
- -- You can have a variable that stores new parts too.
- local newPart = Instance.new("Part", workspace)
- -- Syntax: local <name> = Instance.new(<Type Of Part>, <It's Parent(Where to create it.)>
- -- And here are the Global Variables. (Every script can edit this value.)
- _G.ExampleGlobal = 1
- -- Syntax: _G.<Name> = <Value>
- -- Now let's Create a part and change it's color.
- local colorPart = Instance.new("Part", workspace) -- Creates the part.
- colorPart.Position = Vector3.new(0,20,0) -- Sets the part's Position (0=x,20=y,0=z)
- colorPart.BrickColor = BrickColor.Red() -- Changes brickcolor. (Set's the part's color to red.)
- colorPart.Anchored = true -- Anchors the part. (Makes the part to stay in it's position. It's not affected by gravity.)
- -- Now let's make the part, to change colors.
- while true do
- colorPart.BrickColor = BrickColor.Red()
- wait (1)
- colorPart.BrickColor = BrickColor.Green()
- wait (1)
- colorPart.BrickColor = BrickColor.Blue()
- wait(1)
- end
- -- You can change colors, by creating variables too.
- local RGBred = Color3.fromRGB(255, 0, 0) -- Red color in RGB.
- local RGBgreen = Color3.fromRGB(0, 255, 0) -- Green color in RGB.
- local RGBblue = Color3.fromRGB(0, 0, 255) -- Blue color in RGB.
- -- This means, variables can store color values too.
- -- Example: Part.Brickcolor = Color3.fromRGB(RGBred, RGBgreen, RGBblue)
- -- Thank you for watching this! Hope you learned something :)
- -- (End of: v1.0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement