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
hang on let me try this in a actual game instead of trying to understand.
actually I already tried this but it keeps giving me a nil when getting the second player’s name
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
Wait hold on I try this one again.
And then i swapped Test for my username and the output was
FOR ME
i can provide you what i did and then you can modify it for your code.
No need I have an idea on this one.
That’s interesting. I haven’t used :FireAllClients() enough to fully know how it works.
okay but if you still need help this place should provide you with what i did
test.rbxl (22.0 KB)
: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
@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.
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