RemoteEvent is not getting fired

I tried to fire remoteEvent whenever player joined the game, but it fails. can anyone tell me why
this is in normal script

local players = game:GetService("Players"):GetPlayers();
game.Players.PlayerAdded:Connect(function()
	print("sending",players[1].ClassName);
	scMesh:FireClient(players[1], arr, n);
end)

You’re getting the players before any join, so it will always be an empty array.
Try updating the players list when a player joins.

local Players = game:GetService("Players")
local playerList = {}

Players.PlayerAdded:Connect(function(player)
    playerList = Players:GetPlayers()
    -- ...
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.