Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

could someone explain to me how this script that uses Tween Service works?

Asked by
lytew 99
4 years ago

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()
0
and how does 'Enum' work? lytew 99 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

0
and how does 'Enum' work? lytew 99 — 4y
0
Enum = table stores useful variables((Like keycodes)) but it is global. https://developer.roblox.com/en-us/articles/Enumeration LinavolicaDev 570 — 4y
Ad

Answer this question