what is the client code you have right now?
I highly recommend against using FireAllClients. If an error is thrown, your code won’t be ready to try again for that specific player, and in this specific case there’s another issue that will come up. Use FireClient, and wrap it in a pcall.
In your case here, you definitely don’t want to FireClient for anyone besides the imposters. Exploiters can and will write a script to detect who the imposters are. At no point in time can you let them have access to this info so easily.
Currently I’m trying to use the FireAllClients()
I’m just testing it this time I added wait()
Well i don’t normally use remote events. i usually don’t use local scripts unless i have to.
@Extuls is completely right. If you were to fire all of the clients, and check which players are the imposters on the client instead of the server, exploiters could detect which players are the imposters.
In addition to this i use scripts who can access server storage and using bindable events i am sure that exploiters can not read anything and then to send stuff to that specific player i use a remote event because last time i checked exploiters can not access other’s player gui’s
i am gonna write some code in prevention for that then.
actually I already tried this but it keeps giving me a nil when getting the second player’s name
Could you send me the client event, the script that’s printing the names?
I believe your original code would work, but are you not considering each player separately in the local script? This should not print both at the same time. But rather, it should be printing something similar to:
07:55:58 -- fired
07:55:58 -- Player1
07:55:58 -- fired
07:55:58 -- Player2
I just changed it but I just use print(msg)
Okay so if this doesn’t work then im confused.
i have tested this so its should work.
Baseplate.rbxl (23.0 KB)
Any way I found a solution that is working now, but the only thing is that its printing it twice or firing it twice server script:
gameTable.imposterTeammate = function()
local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
local imp1 = gameTable.imposters[1].Name
local imp2 = gameTable.imposters[2].Name
event:FireAllClients(imp1, imp2)
end
localscript:
local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
local plr = game.Players.LocalPlayer.Name
event.OnClientEvent:Connect(function(imposter1, imposter2)
if imposter1 == plr then
print(imposter2)
elseif imposter2 == plr then
print(imposter1)
end
end)
The reason for this is because you are firing the clients for each imposter. 2 imposters in the for-loop will make it fire all clients 2 times.
I see so how do I make so that It will only fire once?
What do you mean by that can you explain it to me?
exploiters can then read that by using a simple script:
local event = game:GetService("ReplicatedStorage").Events.RemoteEvent event.OnClientEvent:Connect(function(imposter1, imposter2) print(imposter1,imposter2) end)
in my test game i made sure that only the players who were the imposter were notified.
So how do I avoid it so they can’t get who are the imposters?
this is how i setup my game.