-
Notifications
You must be signed in to change notification settings - Fork 1
Lesson 2: API Functions
RigidStudios edited this page May 8, 2020
·
2 revisions
CFrame: (Coordinate Frame)
local cframe = CFrame.new(0,5,0) --[[This is the Positional Component, acts like Vector3, X Y Z]] * CFrame.Angles(math.rad(45),0,0) --[[This is the Rotational Component, the rotations are in Radians, so math.rad() will get you the radian from the degrees. X Y Z]]Vector3:
local vector = Vector3.new(5, 5, 5) --[[Position, to change a part's position you would do]]
workspace.part.Position = workspace.part.Position + Vector3.new(5, 5, 5) --[[You've added 5 studs on each axis to the part. You can also use this in Rotation, and Size.]]Color3: (RGB Color Container)
local color = Color3.new(255,255,255) --[[White]]
local color2 = Color3.new(0,0,0) --[[Black]]BrickColor: (Any Color Type)
local color = BrickColor.new(Color3.new(0,0,0)) --[[Color3 Black]]
local color2 = BrickColor.new(0,0,0) --[[RGB Black]]
local color3 = BrickColor.new("Pastel Green") --[[Color Name Pastel Green]]Of course you can use for loops to edit the position property, but there's a much better and effective way of doing it, TweenService:
local tweener = game:GetService("tweener") -- Get the tweening service, to be able to Tween later on.
local part = workspace.part
local objective = {} -- Creates an empty Dictionary for the objective of the Tween
objective.Position = Vector3.new(0,2,0) -- The object will move 2 Studs upward if it's located at 0, 0, 0.
local time = tweenInfo.new(1, Enum.EasingStyle.Quad)
tweener:Create