Audio queue system throws error "Attempt to index nil with Value"

  1. What do you want to achieve?
    I want to finish my audio queue system. but I keep getting an issue. [see issue below]

  2. What is the issue? (Include screenshots / videos if possible!)

Players.WorkPro2007.PlayerGui.MUSIC.MainFrame.Play.PlaySong:16: attempt to index nil with 'Value'

I’m having an issue with the script because it’s always saying “attempt to index nil with Value”


This is the part of PlaySong script that is giving an error:

while wait(0.1) do
	if workspace["Interior"].StereoSet.Center.Music.Playing == false then
		if workspace["Interior"].StereoSet.Center:FindFirstChild("queuedId") then
			--the line below is the one giving an error--
game.ReplicatedStorage.PlaySong:FireServer(workspace["Interior"].StereoSet.Center:FindFirstChild("queueId").Value, workspace["Interior"].StereoSet.Center:FindFirstChild("queueId").Value)
		end
	end
end
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried every solution on the DevForum, but no solution can fix my problem, apparently. Maybe I’m dumb? Maybe I missed a comma, a dot…? Please help.

Let’s see, you said “game.ReplicatedStorage.PlaySong:FireServer” so your remote event is called “PlaySong”? you might need to include something better to describe it, a remote event is fine but what about a function ?

Also, you will need to specify if its a local player or for everyone, for example if they reset the song starts again, and will be different for everyone. → Players.WorkPro2007

LocalPlayer is declared in my event manager, as FireServer is giving me “Playername AudioId” with the line that has an issue. Example: “WorkPro2007 1682735449”, I don’t know why that happens though since I declare the same ID value two times. Is player always the first variable on FireServer or am I wrong?

Second thing, alright I’ll specify if its for everyone, didn’t notice that.

But still, the problem remains, using what you said before still gives me an error.
I’ll keep searching for solutions while (maybe) you reply again.

Also, what do you mean here with “you might need to include something better to describe it”?

Let’s see, you said “ game.ReplicatedStorage.PlaySong:FireServer ” so your remote event is called “PlaySong”? you might need to include something better to describe it, a remote event is fine but what about a function ?

function or "local PlayerSong = code here

Oh, so instead of longlineofcode.Value should I do that or what?
With “PlayerSong” do you mean the song id that was inputted?

if workspace["Interior"].StereoSet.Center:FindFirstChild("queuedId") `
Here is queuedID

and in

game.ReplicatedStorage.PlaySong:FireServer(workspace[“Interior”].StereoSet.Center:FindFirstChild(“queueId”).Value, workspace[“Interior”].StereoSet.Center:FindFirstChild(“queueId”).Value)

is queueId

You just change the name `=

yes, kind of I can’t really explain it as much but having to define a line of code will show less errors.

So this?

if workspace["Interior"].StereoSet.Center:FindFirstChild("queuedId") then
game.ReplicatedStorage.PlaySong:FireServer(workspace[“Interior”].StereoSet.Center.queuedId.Value, workspace[“Interior”].StereoSet.Center:FindFirstChild.queuedId.Value)
end

Where is this script located…?

No, you just forget D in queued …

 	if workspace["Interior"].StereoSet.Center.Music.Playing == false then
 		if workspace["Interior"].StereoSet.Center:FindFirstChild("queuedId") then
			--the line below is the one giving an error--
game.ReplicatedStorage.PlaySong:FireServer(workspace["Interior"].StereoSet.Center:FindFirstChild("queuedId").Value, workspace["Interior"].StereoSet.Center:FindFirstChild("queuedId").Value)
 		end
 	end
 end
1 Like

It’s on the issue error on the post above.

Players.WorkPro2007.PlayerGui.MUSIC.MainFrame.Play.PlaySong

Oh, I’m so dumb. Didn’t notice the D.