VIP chat message not working. userowngamepass is getting "Argument 1 missing or nil". can someone tell me how to fix this?

-- this in serverscriptservice

local joinedplayer = game.ReplicatedStorage.VIPchatmessage

game.Players.PlayerAdded:Connect(function(plr)
	joinedplayer:FireAllClients(plr.Name)
end)

--and this in starterplayerscripts
   
  local joinedplayer = game.ReplicatedStorage.VIPchatmessage

joinedplayer.OnClientEvent:Connect(function(plr)
	local owngamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 32999242)
	if owngamepass then
		game:GetService("StarterGui"):SetCore("SystemMessage",{
			Text = "VIP"..plr.."Has joined the game! Welcome"..plr,
			Font = Enum.Font.SciFi,
			TextSize = 24,
			Color = Color3.new(1, 1, 0)
		})
	end
end)


1 Like

Change

joinedplayer:FireAllClients(plr.Name)

to

joinedplayer:FireAllClients(plr)

AND

replace plr with plr.Name here.

Text = "VIP"..plr.."Has joined the game! Welcome"..plr,
1 Like

okey. thanks! but how do I fix the error of the userowngamepass?

The changes I mentioned should fix the error.

1 Like

yes it works now thanks for your help :grin:

1 Like

I’ll appreciate it if you could mark my reply as a solution. :slightly_smiling_face:

1 Like

great I did. thanks again for helping.

1 Like