Argument 1 missing or nil

So I have a VIP gamepass tag:

	if ms:UserOwnsGamePassAsync(plr.UserId, 16477873) == true then
		
		speaker:SetExtraData('NameColor', Color3.fromRGB(249, 218, 43))
		speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
		speaker:SetExtraData('Tags', {{TagText = 'VIP', TagColor = Color3.fromRGB(50, 197, 250)}})
		
	end

and on line 23 (first line of the script posted), I am getting the following error in the output:
18:47:04.508 Argument 1 missing or nil

Any help would be appreciated, thanks!

Could you show us the rest of the code?

local plrs = game.Players
 
local sss = game.ServerScriptService
 
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

local ms = game:GetService("MarketplaceService")
 
 
chatService.SpeakerAdded:Connect(function(plr)

    local speaker = chatService:GetSpeaker(plr)


	if plrs[plr].UserId == 284385027 then

        speaker:SetExtraData('NameColor', Color3.fromRGB(249, 0, 0))
        speaker:SetExtraData('ChatColor', Color3.fromRGB(124, 238, 255))
        speaker:SetExtraData('Tags', {{TagText = 'Developer', TagColor = Color3.fromRGB(250, 20, 0)}})

	end
	
	if ms:UserOwnsGamePassAsync(plr.UserId, 16477873) == true then
		
		speaker:SetExtraData('NameColor', Color3.fromRGB(249, 218, 43))
		speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
		speaker:SetExtraData('Tags', {{TagText = 'VIP', TagColor = Color3.fromRGB(50, 197, 250)}})
		
	end
end)

SpeakerAdded returns the name of the speaker, not the player instance, you get the player, just do

local player = game.Players[plr]

and use that

Thanks for the help. Smart me didn’t realise I used that on the Developer tag. Thanks for the help either way!

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!