:FireAllClients() sends 2 requests in one call

Hello everyone! While developping my game I noticed that my local scripts which handle server requests send 2 messages in one use. I thought it was the server script’s problem which fires :FireAllClients() 2 times, but after making one script which makes one request client script still had 2 requests to handle. What could possibly cause this problem?

Server-sided script in workspace:

wait(5)
game:GetService("ReplicatedStorage").RemoteEvents.PlaySound:FireAllClients(1,"SyringePush","Tool",{Parent=workspace,RollOffMaxDistance=50})

Client-sided script:

local rs = game:GetService("ReplicatedStorage")
local soundModule = require(game:GetService("Players").LocalPlayer.PlayerScripts:WaitForChild("ModuleScripts").SoundModule)

rs.RemoteEvents.PlaySound.OnClientEvent:Connect(function(id,soundKey,group,parameters)
	print("Create sound request")
	local sound = soundModule.CreateSound(id,soundKey,group,parameters)
	soundModule.PlaySound(sound,true)
end)

the workspace:


And output (First 4 lines, other are mine scripts which also have this problem)
изображение

Note: This problem also happens to other scripts, not only soundscript

1 Like

I found the answer. My problem was that I used script with RunContext set to “Client” and it basically made client have 2 scripts which handle single request.

1 Like

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