Trying to make an audio progress bar, but it wont change at all
Tried looking around the dev forum, but ive had no luck finding something that was close to my issue, as most opted for tweening, or were based on the wrong values.
task.spawn(function()
while true do
local SoundLength = AudioPlayer.TimeLength
local CurrentPos = AudioPlayer.TimePosition
local Percentage = CurrentPos / SoundLength / 100
local Clip = math.floor(Percentage / 0.1) * 0.1
print(Clip)
ProgressBar.Size = UDim2.new(Clip,0,1,0)
task.wait(.01)
end
end)
AudioPlayer is a Sound object
ProgressBar is a frame in another frame, size being {1, 0},{1, 0}
Im trying to mainly edit the first one, on a range from 0 - just starting, to 1 - finished
game:GetService("RunService").RenderStepped:Connect(function()
local length = AudioPlayer.TimeLength
if length == 0 then return end
local pos = AudioPlayer.TimePosition
ProgressBar.Size = UDim2.new(pos/length,0,1,0)
end)