Still have questions? Join our Discord server and get real time help.
0

# How would I go about scripting a music bar?

Not sure how to describe it, but games like Club Raven and Mocap Dancing have a bar at the top of the screen that fills a specific spot of the screen over the course of the song. I have my own music script set up, but I'm trying to script my own music bar. I have no clue how I need to be going about this.

0
You would first try then come back and post it here and then we would be glad to help ^_^ greatneil80 1140 — 8mo
0
I did. That's why i'm asking here. Zombie_Panic 13 — 8mo
0
Provide the code you tried, and we can help you fix your issue! You may also want to give a bit more clarification on what you mean when you say "music bar". SummerEquinox 623 — 8mo

0
oilsauce 175
8 months ago

Since you haven't provided us with a script to begin with, I'll just tell you some things you need to know when you're making a music-progress bar.

I will use a Frame object as an example.

local plr = game:GetService("Players").LocalPlayer
local plrgui = plr:WaitForChild("PlayerGui") -- waits until 'PlayerGui' is an object inside of 'plr'.
local Gui = plrgui:WaitForChild("Gui") -- assuming that the ScreenGui is named 'Gui'.
local Frame = Gui:WaitForChild("Frame") -- assuming that the Frame inside of the ScreenGui (Gui) is named 'Frame'.
local Music = workspace:WaitForChild("Music")



These are the least variables you need to make the bar. the Music variable is supposed to be a Sound object named 'Music' inside of Workspace.

Music:Play()

while true do
Frame.Size = UDim2.new(Music.TimePosition / Music.TimeLength, 0, 0.1, 0) -- The 0.1 is optional.
wait()
end



Music.TimePosition / Music.TimeLength is supposed to be equaled to the Ratio of the Music's position of the song. So if the song is only at 1/10 of the entire song, it'll be equaled to 0.1. If it's at 5/10, it'll be 0.5, and if it's at 10/10. it'll be 1.

the Frame's Size's X scale property changes the Frame's X Size to whatever percentage the property is . If the property is 0.5, the Frame's X size will be the 5/10 size of the Roblox screen.

We use a while loop to keep changing the size, as the Music is continuously playing.

I'm sorry if you didn't understand something, I was pretty sleepy by the time I was writing this. For specific function and keyword explanations, please go look at the wiki.