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

How do i use tweenservice?

Asked by 3 years ago

I been looking all around the web but i can't find how to use tweenservice can someone help me?

2 answers

Log in to vote
1
Answered by 3 years ago

https://developer.roblox.com/en-us/api-reference/class/TweenService

First, know what EasingStyle and EasingDirection is, it is what makes the tween look customized the way you want smoothly.

Then, use TweenInfo to make your desired tween settings information.

local info = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out
-- 0.2 is the time it takes to finish the tween, Quad is an example easing style, Out is an example easing direction when you want to make a tween that focuses on going “outward” 

Then create the tween like this:

local tween = TweenService:Create(object, info, {Property = New})

You must define TweenService and the object you want to tween with. The third argument is a table where each index (Property) equals the new value you want to change to (New).

The table can have multiple properties to change simultaneously but I will only use one property to change in the example, just separate your properties with a comma or semi-colon if you want to add new changes.

An example for changing part position would be:

local object = workspace.ExamplePart
local tween = TweenService:Create(object, info, {Positon = Vector3.new(9, 7, 1)})

Then the tween object is what tween is, which you can use :Play() on it to start the tween and you can also track when it is completed with the Completed event.

local object = workspace.ExamplePart
local tween = TweenService:Create(object, info, {Positon = Vector3.new(9, 7, 1)})
tween:Play()
tween.Completed:Wait()
print(“Tween finished”)

Keep in mind that GUI objects (frames, buttons, labels, etc) except UIConstraints have a function for changing their position, size, or both but are not using TweenService, these have different arguments to use but you could still use TweenService on them for position/size if wanted.

0
thank you MAJORSPY4 0 — 3y
0
Mark my answer as the solution since it helped you, you’re welcome. ArtFoundation 255 — 3y
0
I'll do it for you greatneil80 2647 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Thanks man thank you alot

Answer this question