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

How would I make a sound progress bar? [closed]

Asked by 7 years ago

So like I want a frame with a frame inside it that fill up the outer frame and should be right at the end once the sound has ended, how would I do that. For any song.

0
local frame = frame phoca 0 — 7y

Closed as Not Constructive by hiimgoodpack, abnotaddable, and PyccknnXakep

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

When you create the sound, you use Instance.new("Sound") The object you get from that is the Sound object, you can use sound.TimeLength (for the full length of the music) and then sound.TimePosition for the amount of time elapsed of that music

Using that you can change the width of a frame inside the other frame by simply dividing the current position by the full size

local sound = mysoundvariable
local parent_frame = script.Parent:FindFirstChild("Frame")
local progress_frame = parent_frame:FindFirstChild("Frame")

-- Every half second
while wait(.5) do
    parent_frame.Size = UDim2.new(sound.TimePosition/sound.TimeLength, 0, 1, 0)
end

This is untested, but this is just the general idea.

Ad