OnClientEvent not receiving parameters

Alright so i’m making a party invitation system for my game

-The problem is that when I use OnClientEvent, every parameter is nil.

The scripts that fires:

script.Parent.OnServerEvent:Connect(function(player,v,mod,)
	local modr = require(mod)
	print(player)--this part works, yet the onclientevent doesn't?
	modr:SendInvite(v,player)-- V is the player to send the invite to and player is the person that sent the invite.
end)

the OnClientEvent script

game.ReplicatedStorage.InviteToParty.OnClientEvent:Connect(function(player)
	print("invite recieved from "..player)-- I get an error: attempt to concantenate string with nil
end)

First of all you should do player.Name instead of player if you’re trying to print the player’s name because player is not a string, but it’s an instance. You cannot print it as a string.

Are you sending from the client to the server and back to the client? If yes, then you should use a remotefunction.

Player objects don’t replicate between the client and the server. Send the player’s name instead.

It prints the player’s name either way in the server script though

What parameter did you pass to :FireClient()? The player or the player’s name?

The player, the script that receives the parameters then changes it to player.Name in a varibale

Can you show what is inside of the modr module?

The player object does replicate though

1 Like

Oops It was me i made a mistake in the module script

function Party:SendInvite(PlayerToInvite)
	
	game.ReplicatedStorage.InviteToParty:FireClient(Player,Leader)
	
end

This is what I was suspecting.

Thanks!
My bad, they do actually replicate, fixed my posts.

1 Like