In a server module script, I use FireAllClients()
on a remote event, and I know it only fires once from the server because of print detection. Here’s the server script:
function MonsterHandler:_SpawnMonster(monsterType: string, pathID: string, pathProgress: number, multiplier: number): (Monster?, string)
-- Code for spawning the monster, unrelated
local monsterRenderInfo = {
monsterID = monsterID,
modelName = monster.modelName or monster.name,
pathProgress = 0,
pathID = monster.pathID,
movementAnimationID = monsterConfig.movementAnimationID
}
SpawnMonster:FireAllClients(monsterRenderInfo)
return monster, "Monster successfully spawned."
end
function MonsterHandler:SpawnMonster(monsterType: string, pathProgress: number?, multiplier: number?): (boolean, string)
for _, path in ipairs(self.paths) do
local result, reason = self:_SpawnMonster(monsterType, path.id, pathProgress or 0, multiplier or 1)
if not result then return false, reason end
end
return true, "Monster successfully spawned"
end
I have verified that there is only one path in self.paths
, which is not an issue. Here is the local script that receives the (seemingly two) signals:
local function spawnMonster(monsterRenderInfo: MonsterRenderInfo)
-- Code for spawning the monster on the client, unrelated
return true, "Monster successfully spawned on client."
end
SpawnMonster.OnClientEvent:Connect(spawnMonster)
I’ve looked through all of my other scripts, and there is no trace of other activations from other scripts. I even tested sending a custom string from my server script stating, “This is from {server script name}
” to confirm that the signal comes from the same location, which it does. I’m absolutely stumped and have no clue how to fix this issue. I’ve even run debugs to determine the RemoteEvent is indeed receiving two signals instead of the spawnMonster
function running twice.