could someone explain this script to me? How does 'Tweeninfo new' and its variables work. I wanted to understand better
local TweenService = game:GetService("TweenService") local partToMove = script.Parent local originalCFrame = partToMove.CFrame local tweenInfo = TweenInfo.new( 2, Enum.EasingStyle.Linear Enum.EasingDirection.Out, -1, true, 0 ) local goal = { CFrame = originalCFrame * CFrame.new(3, 0, 0) } local tween = TweenService:Create(partToMove, tweenInfo, goal) tween:Play()
Alright, I think this is how they work.
The first one is the length of the Tween.
EasingStyle is how it moves. Linear goes pretty smooth, Elastic goes pretty crazy, Bounce is of course bouncy, and there's alot more EasingStyles.
EasingDirection is how it goes. According to the Roblox Developer wiki, In is pretty slow, and out is pretty fast. And InOut is like medium speed.
The third one is how much times it loops. -1 will do it infinitely.
The fourth one is Reverse. If it's set to true, it will do the same thing again but the opposite.
The fifth one is the delay time.
By the way, I watched DevKing's tutorial on TweenService and he said you need to add a wait() before you Tween so it can work.