Right now, I am currently trying to make a jukebox that will add songs to a queue when requested by players. For some reason, one bindable event won’t fire. There are no errors in the output, it just won’t fire the function.
Here are the 2 scripts that involve this bindable event;
Queue Manager:
Click Me
local remote = repStorage.MusicTransfer
local songdone = repStorage.NextSong
local queuesubmit = repStorage.QueueSubmit
local queue = {}
remote.OnServerEvent:Connect(function(plr, msg)
print("got request")
local tablenumber = table.getn(queue)
table.insert(queue, tablenumber + 1, msg)
end)
songdone.Event:Connect(function()
print("got done")
local tablenumber = table.getn(queue)
if tablenumber == 0 then
print("no song in queue")
queuesubmit:Fire(false)
else
print("song in queue; sending")
print(queue[1])
queuesubmit:Fire(queue[1]) -- THIS IS THE CALLER
table.remove(queue, 1)
print("song sent")
end
end)
Jukebox Manager:
Click Me
local songdone = repstorage.NextSong
local queuesubmit = repstorage.QueueSubmit
local audio = workspace.SoundRegion.Audio
local autosongs = {6609420237}
while true do
-- pick random song
local randnum = math.random(1,1)
for i,v in pairs(autosongs) do
if i == randnum then
-- load song
audio.SoundId = "rbxassetid://"..v
wait(2)
wait(audio.TimeLength)
songdone:Fire()
queuesubmit.Event:Connect(function(msg) -- THIS IS THE FUNCTION THAT WILL NOT CALL
print("got queue response")
if msg == false then
print("no song in queue response")
else
print("got queue song response")
audio.SoundId = "rbxassetid://"..msg
wait(2)
wait(audio.TimeLength)
songdone:Fire()
return
end
end)
end
end
end
If you know an easier way to make a system like this or you know the specific issue, please let me know!