#Issues with Music Player

10 messages · Page 1 of 1 (latest)

marble wadi
#

Hey!

I'm having issues with a music player in my Obby game. It's something about not syncing with all players and jumping to different timestamps in a song on its own behalf. Sometimes it's just straight up quiet. I've tried many different things, such as running the scripts completely local on the player, but there's just something that doesn't work and I'm out of ideas. In my opinion, there's nothing wrong with the scripts, so perhaps I'm dealing with some strange bug?

What I've gathered from my debugging is that the first player to join the server and initiate the script for the first time won't experience any issues at all. The playlist goes on and the GUI updates as it should. But the players that **DIDN'T **initiate the server will face the issues stated above.

The music player is based on this video: https://www.youtube.com/watch?v=M5Fl89c_o6s, but I've modified the scripts, so it fits my needs.

I'll send some screenshots of the system and have the scripts written in the thread, and hopefully someone here will have some thoughts that might help. It would be a charm to get this working. 🙂

#

NotificationHandler LocalScript

-- This script updates the UI Frame and makes it display the correct song name.

local mps = game:GetService("MarketplaceService")

local music = workspace:WaitForChild("CurrentMusic")

local notifBG = script.Parent
local musicName = notifBG.MusicName


function updateMusic()

    local id = string.gsub(music.SoundId, "rbxassetid://", "")


    local success, info = pcall(mps.GetProductInfo, mps, id)

    if success then

        musicName.Text = info.Name
    end
end


updateMusic()


music:GetPropertyChangedSignal("SoundId"):Connect(updateMusic)

LocalScript Mute Button

-- This script mutes the music for a local player.

local song = game.Workspace.CurrentMusic
local button = script.Parent

button.MouseButton1Click:connect(function()
    if song.Volume == 0 then
        song.Volume = 0.25
    else
        song.Volume = 0
    end
end)

button.MouseButton1Click:connect(function()
    if song.Volume == 0.25 then
        button.Text = ("Unmute Music")
        button.BackgroundColor3 = Color3.fromRGB(139,255,126)
    else
        button.Text = ("Mute Music")
        button.BackgroundColor3 = Color3.fromRGB(255,133,133)
    end
end)

MusicPicker Script

-- This script picks the music from the given ID's. ID's are given through StringValues that are located as children for this script.

local currentSound = workspace:WaitForChild("CurrentMusic")

local songs = script:GetChildren()


while true do
    
    for i, song in pairs(songs) do
        
        local id = song.Value
        
        currentSound.SoundId = id
        
        currentSound:Play()
        
        wait(1)
        wait(currentSound.TimeLength / currentSound.PlaybackSpeed)
    end
end
pulsar ginkgo
marble wadi
#

All tips and tricks are welcome! Who knows, it might even fix the issue? My DM's are turned off at the moment, so link that API here. 🙂

humble willowBOT
#

studio** You are now Level 1! **studio

pulsar ginkgo
#

its under the setcore thingy but you should be able to find it

#

if you want a tut here is a good one i know

marble wadi
#

I'll have a look at it. I was also debugging on the same device (but it shouldn't matter). I'll keep trying.