My remote event doesn't seem to be passing?

Hi! I’ve being working on this for a few days now and I still can’t figure it out.

-- Server script in ServerScriptService


local sendTables = game.ReplicatedStorage.RemoteEvents.SendTables 
local module = require(game.ServerScriptService.module)

local players = {}
local non_players = {}

while true do
	for i, plr in pairs(game.Players:GetPlayers()) do
		if plr.TeamName.Value == 'Player' and plr.ListedOnHealth.Value == false then
			if module.checkForTable(non_players, plr.Name)  then
				table.remove(non_players, table.find(non_players, plr.Name))
			end
			table.insert(players, 1, plr.Name)
			plr.ListedOnHealth.Value = true
		elseif plr.TeamName.Value ~= 'Player' and plr.ListedOnHealth.Value == true then
			if module.checkForTable(players, plr.Name) then
				table.remove(players, table.find(players, plr.Name))
			end
			table.insert(non_players, 1, plr.Name)
		end
	end 
	print(players)
	print(non_players)
	sendTables:FireAllClients(players, non_players)
	wait(0.1)
end

This is the local script

--Local script in a starterGui

local frame = script.Parent.Frame
local template = frame.Template
local sendTables = game.ReplicatedStorage.RemoteEvents.SendTables



sendTables.OnClientEvent:Connect(function(players, non_players)
	if players and non_players then
		for i, plr in pairs(players) do
			print('going thru')
			if script.Parent:FindFirstChild(plr.Name) == nil then
				local newTemp = template:Clone()
				newTemp.Name = plr.Name
				newTemp.Parent = frame
			end
		end
		for i, plr in pairs(non_players) do
			print('going thru2')
			if script.Parent:FindFirstChild(plr.Name) ~= nil then
				local destroyPlayer = script.Parent:FindFirstChild(plr.Name)
				destroyPlayer:Destroy()
			end
		end
	end	
end)

Any help would be appreciated. Thank you!

1 Like

For additional info, the server script is generating tables and printing them, but they aren’t getting to the local script somehow

In the local script, right underneath…

sendTables.OnClientEvent:Connect(function(players, non_players)

have you tried putting…

print(players, non_players)

So you can see what you are getting from the server, if anything at all? It doesn’t look as if there is anything wrong with the way you have the remote event set up.

1 Like

Ok, so I printed out the values and after a hour I found the problem, which was that I accidentally put plr.Name instead of just plr because of how I coded it. Thanks