How would i make a remote even fire to a specific group of players

this is probably really simple but I need to fire a remote event to only the players on a team.

I couldnt find anything online abt it online, this was my attempt on trying it:

screenshake:FireClient(game.Teams.Playing:GetPlayers())
1 Like

U could add a table of players (the group) in the second parameter in the fire client and then

screenshake.OnClientevent:connect(function(plrGroup)
    if plrGroup[game.players.localplayer.name] then
        --effect
    end
end)
2 Likes

Thanks! it worked

30 asoidf chars

I recommend marking @ZINTICK 's answer as solution so that other people can see that this post was answered as well!

1 Like

I wouldn’t recommend this approach since the ‘RemoteEvent’ object ends up performing work it can otherwise avoid.

Also OnClientevent should be OnClientEvent.

local Game = game
local Teams = Game:GetService("Teams")
local RedTeam = Teams.RedTeam

for _, RedPlayer in ipairs(RedTeam:GetPlayers()) do
	RemoteEvent:FireClient(RedPlayer)
end
1 Like

yes I suppose that is one way you could do it

I knew this it was just example code