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.
1 Like

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 ?

1 Like

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

1 Like

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.

1 Like

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 ?

1 Like

function or "local PlayerSong = code here

1 Like

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 `=

1 Like

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…?

1 Like

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
2 Likes

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.

1 Like