How do I receive the table from a RemoteEvent

its your random thing generator thing.

No the random it just chooses on who will be on that table the gameTable.imposters

In this case, I could recommend that you try this:

Your own way before, but modified.

1. gameTable.imposterTeammate = function()
	local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
	
	for i, players in pairs(gameTable.imposters) do
		event:FireClient(players, players.Name) -- Modified to use 'players.Name' instead of 'gameTable.imposters.Name' because you have already been looking for the imposters in your for-loop
	end
end

I must understand how this works. So you want to let the client who are the imposters know that they’ve been chosen to be imposters? If that’s the case, you wouldn’t want to use :FireAllClients() because that would fire to every player in the whole game.

Sorry, I am new to posting to Roblox Developer Forum, so I am taking a long time to write out things.

yes but i then told him to use a local script to check for their name

I found a different solution that is working.

gameTable.imposterTeammate = function()
	local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
	local imp1 = gameTable.imposters[1].Name
	local imp2 = gameTable.imposters[2].Name
	
	for i, players in pairs(gameTable.imposters) do
		if players.Name then
			event:FireClient(players, imp1, imp2)
		end
	end
end

Please try what I sent you and let me know if it works.

Oops! I left the ‘tostring()’ in there. You don’t need that for a name since it’s already a string :grimacing:

1 Like

hang on let me try this in a actual game instead of trying to understand.

1 Like

actually I already tried this but it keeps giving me a nil when getting the second player’s name
Screenshot_1

1 Like

Okay so what i tried was a simple test i put this in a script:

game.ReplicatedStorage.Event:FireAllClients({"Test"})

and in a local script i put this in:

game.ReplicatedStorage.Event.OnClientEvent:Connect(function(Table) if table.find(Table,game.Players.LocalPlayer.Name) then print("FOR ME") else print("NOT FOR ME") end end)

and the output was

NOT FOR ME

2 Likes

Wait hold on I try this one again.

And then i swapped Test for my username and the output was

FOR ME

1 Like

i can provide you what i did and then you can modify it for your code.

1 Like

No need I have an idea on this one.

That’s interesting. I haven’t used :FireAllClients() enough to fully know how it works.

1 Like

okay but if you still need help this place should provide you with what i did

test.rbxl (22.0 KB)

1 Like

:FireAllClients() Fires it to every single player you then have to add some local code to check if the table has their name inside and if not then do something else

1 Like

@MakerDoe There should be two separately firing of the client, one for each of the players. Perhaps it is showing up as nil because you have attempted to consider both at the same time?

You should have both separately fired, as the for-loop is doing. then print the name one at a time.

1 Like

Bruh why is it still giving me a nil for the second player’s name.

So I should add a wait. Let me try this one

what are you trying to do? because i can send as many as i want in the table and i get them all.

Could you send us the client event? I want to make sure you are going through each player individually per firing