I am just having trouble understanding how it works(I'm talking about how wiki ect explains it, maybe im just reading the wrong wiki). I am fine when it comes to gui. But for parts I figured it would be better to tween instead of use loops.
Tweening is the process of smoothly making any numerical property transition from it initial state towards another, to start get the tweenservice
local TweenService = game:GetService("TweenService")
then lets look at how to make a tween:
local Tween = TweenService:Create(...)
we will replace the dots with three values, the part (or any instance really), the tweeninfo (a value containing information about how the tween plays and looks), and the dictionary (a table containing propertys that the tween will make the instance transition to)
1: The part (or instance), this is should be obvious, 2: The tweeninfo, its a special roblox exclusive data type like Vector3 or Faces:
tweeninfo.new( how many seconds the tween takes to complete (1 = default), an EasingStyle enum (Enum.EasingStyle.Quad = default), an EasingDirection enum (Enum.EasingDirection.Out = default), how many times to repeat (0 = default), will it reverse each time (false = default), the delay until the tween starts (0 = default) )
and examples of different easingstyles (and directions) here: https://developer.roblox.com/assets/5ad23898c052d5f20b766854/Easingstyle.gif
3: the dictionary, this is a table with properties of what the new properties will be, example:
{ Size = Vector3.new(1,5,2), ["CFrame"] = CFrame.new(1,1,99), Transparency = 0.7, Massless = true, Color3 = Color3.new(1,1,1) }
so now with all of the examples we can make a tween
local Info = tweeninfo.new( 1, Enum.EasingStyle.Linear --everything in a tweeninfo is optional ) local Dict = { Size = Vector3.new(1,5,2), ["CFrame"] = CFrame.new(1,1,99), Transparency = 0.7, Massless = true, Color3 = Color3.new(1,1,1) } local Tween = TweenService:Create(script.Parent.Part, Info, Dict) Tween:Play()
we can also stop a tween
Tween:Stop
documentation of the tween object is here:
https://developer.roblox.com/api-reference/class/Tween