What the is problem

The problem is that when I call the Function sendMusicIntro on myself, it errors, and does not send an Music Intro, however, I have tried multiple times to fix this, but all attempts failed, and still came back with the same error.

What the Error is saying

The Output keeps returning back; 21:29:49.054 - Workspace.XAdminCommandsX's Admin V1:73: attempt to index local 'plr' (a nil value) 21:29:49.055 - Stack Begin 21:29:49.058 - Script 'Workspace.XAdminCommandsX's Admin V1', Line 73 - global ChkAdmin 21:29:49.059 - Script 'Workspace.XAdminCommandsX's Admin V1', Line 567 - global Chat 21:29:49.065 - Script 'Workspace.XAdminCommandsX's Admin V1', Line 325 - global sendMusicIntro 21:29:49.068 - Script 'Workspace.XAdminCommandsX's Admin V1', Line 563 21:29:49.070 - Stack End However, I am confused as to why it is doing this, because it is not calling upon a nil Player.

The code This is the code I have been using:

function sendMusicIntro(plr)
	print("Music Intro is: ",AdminCommandsSettings['MusicPlayOnEnter'])
	if AdminCommandsSettings['MusicPlayOnEnter'] then print(plr,plr.Name)
		print("Audio Playing")
		Chat("TheeDeathCaster",Prefix.."stopmusic "..plr.Name)
		Chat("TheeDeathCaster",Prefix.."music "..plr.Name.." "..AdminCommandsSettings['MusicId'])
		wait(AdminCommandsSettings['AudioDuration'])
		Chat("TheeDeathCaster",Prefix.."stopmusic "..plr.Name)
		print("Finished Audio")
	else
		print("Music Intro not Activated")
	end
end

If I need to add more information about the code, just let me know and I'll edit my Question. :)

4 comments

0

How are you calling the function

0

@Goulstem In my Admin Commands, I call it as 'sendMusicIntro(plr)', as the Player variable in my Admin is 'plr', why..?

0

How do the line numbers line up? Can you provide where this function is being called? If there's something wrong with the parameter, that matters more than this

0

@BlueTaslem From what I read from my Output error, it seems to error when I call the 'Chat' function, but, I've done this before with another command in my Admin Commands, so I don't know why it's error-ring like this. Do you want me to Post the code that gets the Player when it joins?