When ever I fire the remote event with the FireClient(plr, atable) on the second argument its sending me a nil here’s the script for the server:
gameTable.imposterTeammate = function()
local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
for i, players in pairs(gameTable.imposters) do
event:FireClient(players, tostring(gameTable.imposters.Name)) --Even if I remove the tostring still a null
end
end
Here is for the localscript:
local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
event.OnClientEvent:Connect(function(msg)
print("fired")
print(msg)
end)
Any idea on how I can receive the table using FireClient() .
gameTable.imposterTeammate = function()
local event = game:GetService(“ReplicatedStorage”).Events.RemoteEvent
for i, players in pairs(gameTable.imposters) do
event:FireClient(players, tostring(gameTable.imposters.Name)) --Even if I remove the tostring still a null
end
end
your code is possibly incorrect.
it should be something like this
gameTable.imposterTeammate = function()
local event = game:service(“ReplicatedStorage”).Events.RemoteEvent
event:FireAllClients(gameTable.imposters)
end
That’s what I realized thank you so much it help me a lot, but can exploiters use this advantage like they will make a table and put their names and use event:FireAllClients(“there names.”).
A client can only use Event:FireServer() and Event.OnClientEvent . The client cannot call :FireClient() or :FireAllClients() on any event, nor can it read Event.OnServerEvent . All a client can do is listen for events from the server or send an event to the server. The client cannot send data between clients without going through the server first. Therefore, the server should act as a filter between clients, and it’s your job as a scripter to create that filter and only let through what your game decides is allowed to be let through.
This will run twice because if there are more 10 players in the game then it will run twice.
Because I want to let those two imposter know where its teammate are all the time that’s why I am trying to send the table for the imposters to the players who has it and create a billboard gui.
gameTable.chooseTheImposter = function()
local getPlayers = game:GetService("Players"):GetChildren()
local chosen = math.random(1, #getPlayers)
local chosenPlayer = getPlayers[chosen]
if gameTable.inGame[chosen] then
if not gameTable.imposters[chosen] then
gameTable.removePlayer(chosenPlayer)
return chosenPlayer
else
wait()
return gameTable.chooseTheImposter()
end
else
wait()
return gameTable.chooseTheImposter()
end
end
gameTable.imposterTeammate = function()
local event = game:service(“ReplicatedStorage”).Events.RemoteEvent
event:FireAllClients(gameTable.imposters)
end
That Harry_TheKing1 typed, its still giving me the same name.
gameTable.imposterTeammate = function()
local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
for i, players in pairs(gameTable.imposters) do
event:FireAllClients(players.Name)
end
end