You can use TweenService, read about it on hub this so useful thing you can do anything with it smoothly
I see! But there isn’t a easier way? I now with stuff like guis you can just say gui:TweenSize(…) Why didn’t they make that with parts too?
Yes they did do it with parts (i’m not sure), but with this method you can do more things at the same time
local Goals = {Size=Vector3.new(50,50,50),Transparency = 1}-- the size to tween to, the transparency to change to
Honestly ik what you mean but I just want a ez tween size lol. Ill figure out the other one once I need it
Wait so I’d just put local Goals = {Part.Size=Vector3.new(50,50,50)} and this would just change the size…
Here’s a quick run down on the tween service.
In order to create a tween you must first import the TweenService into your script by doing
local tweenService = game:GetService("TweenService")
.
Once you’ve imported it, you can then begin creating your tween. Tweens need a TweenInfo to be able to work, so let’s make one!
A TweenInfo is a constructor with properties that your tween will obey. You create a tween info like this:
local tweenInfo = TweenInfo.new(time, easing style, easing direction, repeat count, reverses, delay time)
The time is the time your tween will take to complete.
The easing style is an enumerated value (Enum) that dictates how the tween will behave. In order to insert it you must pick an easing style and access it by doing Enum.EasingStyle.Style
. A list of styles can be found here.
.
The easing direction is the direction in which the part will perform the easing style in. There are two easing directions: in and out. In your tween info, you must write it as Enum.EasingDirection.Out or Enum.EasingDirection.In.
The reverses is a boolean that dictates whether or not the tween reverses once completed.
The repeat count is how many times your tween will repeat, and the delay time is the amount of time that elapses before the tween starts (essentially putting a wait()
before the tween).
Here’s an example of a tween info:
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, false, 0)
Now we must set a goal. You can do this by creating a simple table:
local goal = {}
Now that we have our local set up, input your desired part size.
goal.Size = Vector3.new(sizeX, sizeY, sizeZ)
Now that we have our TweenService and our TweenInfo, it’s finally time to tween the part. Here’s how you do that:
local tween = TweenService:Create(part, tweenInfo, goal)
Finally, we must play the tween by doing tween:Play()
Your final code should look something like this:
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, false, 0)
local part = game.Workspace.Part
local goal = {Size = Vector3.new(sizeX, sizeY, sizeZ)}
local tween = tweenService:Create(part, tweenInfo, goal)
tween:Play()
Hope this helps.
Woah. I gave it a solution no thought bout it.
Haha, thanks! Let me know if you have any more questions. Here’s the page on the TweenService in case you need it:
With tweening direction. Does this mean like making it bigger or smaller. Or is this just to find the part you are going to tween?
Did you mean easing direction?
Yeah that! WordsFor30CharRule
Oh, I see. The easing direction is the direction that your easing style will play into. Here’s the page for easing directions. It contains a GIF example that I highly recommend looking at to truly understand:
Edit: It appears I was mistaken in my initial reply: There are THREE easing directions. In, Out, and InOut
Ohh I see! So its like the style of the easing style. Ish.
In a sense, it’s more like the direction that the easing style is going. Imagine you have a finish line, and a racecar is approaching it. If the easing style were “in”, the car would accelerate the closer it got to the finish line. If the easing style were “out”, the car would decelerate the closer it got to the finish line. If it were “inout”, the car would accelerate when approaching but decelerate before finishing.
Dang. That helps so much. You should become a teacher XD
Haha thanks! I’ll consider it, but I’ll stick to the forums for now lol. Let me know if you have any more questions
game.Players.PlayerAdded:Connect(function(player)
wait(5)
while true do
wait(0.001)
if player:WaitForChild("leaderstats"):WaitForChild("Time").Value > player:WaitForChild("leaderstats"):WaitForChild("TopTime").Value then
player.leaderstats.TopTime.Value = player.leaderstats.Time.Value
local Stick = player.Character:FindFirstChild("HumanoidRootPart"):FindFirstChild("Stick")
if Stick.Size == Vector3.new(0.538, 7, 3.231) then
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, false, 0)
local part = Stick
local goal = {Size = Vector3.new(0.705, 9.167, 4.231)}
local tween = tweenService:Create(part, tweenInfo, goal)
tween:Play()
end
if Stick.Size == Vector3.new(0.705, 9.167, 4.231) then
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, false, 0)
local part = Stick
local goal = {Size = Vector3.new(0.538, 7, 3.231)}
local tween = tweenService:Create(part, tweenInfo, goal)
tween:Play()
end
end
end
end)
``` So basically I'm trying to make a cool effect play whenever someone breaks their top time but the issue is. Isn't playing nor erroring.. Could you maybe help..
Interesting. Try to see if your if conditions are being met. Add a print statement after each if condition and check to see which one isn’t being met.
Ok! Smart! Ill do that rn
So basically it says the size of the part is 0.705, 9.167, 4.231 but it isnt tweening back down…
And i cant see the change to 0.705, 9.167, 4.231
Sorry was AFK. Is it throwing any errors?