Hello. My name’s Uneducated Scripter and I’ve put together a Simple Tweening script for those who don’t know how to do it. I know for some people this is an easy topic but I’m just helping out.
So down below I have made a Simple Video and Script with quotes to help you get use to tweening.
I used an TextButton but the tween doesn’t have to be used through buttons.
Here is the code below
--Simple tweening by UneducatedScripter
local TweenService = game:GetService("TweenService")--For getting tween service
script.Parent.MouseButton1Click:Connect(function()
local Part = workspace.Part
local Goal = {} --Changes happening to the block
Goal.Size = workspace.PartEnd2.Size
Goal.Position = workspace.PartEnd2.Position
Goal.Color = Color3.new(0.517647, 0.517647, 0.517647)
local Tween = TweenInfo.new(--This local "Tween" is going to control our animation. Ex. Timing, Style, Direction, Repeats, Reverse, and Delays.
1,--Timing
Enum.EasingStyle.Linear,--EasingStyle
Enum.EasingDirection.In,--EasingDirection
0,--Number Of Times Animation Is Repeated(Setting this number to -1 will repeat it forever until canceled.)
false,--Number Of Times Tween Reverses
0--Delayed Time Between Tween
)
local Tweening = TweenService:Create(Part,Tween,Goal)--This local "Tweening" is going to put everything together and get it ready to be played.
Tweening:Play()--Plays the tween
wait(0.3)
Tweening:Pause()--Pauses the Tween. This was only used for the video not important. But It pauses the tween during animation.
--You could also use ":Cancel" to void the entire animation.
wait(1)
Tweening:Play()
wait(2.5)
local Goal2 = {}--This is not important but If you want to see how it works with multiple parts then replace everything down below.
Goal2.Size = workspace.PartEnd3.Size
Goal2.Position = workspace.PartEnd3.Position
Goal2.Color = Color3.new(1, 1, 1)
local Tween2 = TweenInfo.new(
1,--Timing
Enum.EasingStyle.Linear,--EasingStyle
Enum.EasingDirection.In,--EasingDirection
0,--Number Of Times Animation Is Repeated
false,--Number Of Times Tween Reverses
0--Delayed Time Between Tween
)
local Tweening2 = TweenService:Create(Part,Tween2,Goal2)
Tweening2:Play()
end)
Hope you learned something let me know if I should do more easy stuff or hard stuff