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

How do I use tween to make a countdown bar when a player is added to the game?

Asked by 4 years ago
Edited 4 years ago

So what I want to do is make a countdown bar, when the GUI load in this case

game.Players.PlayerAdded:Connect(function(player)

I want the bar to start heading right until it touches the GUI from the left side of the GUI. And that should last 5 secs. What will the script look like and how will it be scripted.

1 answer

Log in to vote
0
Answered by
c0nc3rt 61
4 years ago
Edited 4 years ago

You can use TweenPostion, it's the child of the Frame

Uses

Example, you want to move the frame from right to the left with smooth style, so the code should be like this:

set the frame position to 1,0,0,0

local frame = script.Parent --the local script should be in the frame

frame:TweenPosition(Udim2.new(0,0,0,0),"InOut","Sine",2) --the 0,0,0,0 is the position where the frame should move to at.
wait(5) --remain for 5 secs
frame:TweenPosition(Udim2.new(1,0,0,0),"InOut","Sine",2) --move back to it's old position

"InOut,"Sine" is the moving style, you can learn more about this:here

number at the bottom is the length of the time the frame move to the finish

ex : the frame with move to 0,0,0,0 for 2 secs length.

you can change 2 to 5 or what number you want

That's all what i know.

Ad

Answer this question