Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I make a sound progress bar?

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.

1 comment

0

local frame = frame

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.