FireAllClients() not firing

I am trying to set some CFraming for the camera, however, the script doesn’t really work.

Script
-above are just locals
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
--Model variables
local SecondCamera = Model.SecondCamera
--Tower smoke turning red; for animation event #1
local RedCK = {
	--API: ColorSequenceKeypoint.new(time, color)
	ColorSequenceKeypoint.new( 0, Color3.fromRGB(255,0,0)),
	ColorSequenceKeypoint.new(.5, Color3.fromRGB(255,0,0)),
	ColorSequenceKeypoint.new( 1, Color3.fromRGB(255,0,0))
}
local RedCS = ColorSequence.new(RedCK)
local TowerSmoke = workspace.NotNecessary.Lyoko.InsideActivatedTower.Smoke.ParticleEmitter
Animation:GetMarkerReachedSignal("TurnTowerSmokeRed"):Connect(function(paramString)
	TowerSmoke.Color = RedCS
end)
--Functions
RemoteEvent:FireAllClients(SecondCamera)
wait(1)
print("nok")
Local Script
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
--Functions
RemoteEvent.OnClientEvent:Connect(function(part)
print("ok")
game:GetService("RunService").RenderStepped:Connect(function()
Camera.CFrame = part.CFrame
end)
end)

Only “nok” is printing. Did anyone get any idea?

1 Like

do you have multiple remote events in that folder with the same name?

No; only a RemoteEvent with the exact same name in ReplicateStorage.

can i get a picture of your replicated storage folder?

Try using :FindFirstChild when defining the remote.

Sure; here you go.
image

1 Like

Client, server? Or both, actually?

Try using both, let me know if it works out

I have tested, (both) it doesn’t works.

add a waitforcharacter so the player can load in

--server
wait(2)
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
RemoteEvent:FireAllClients()
wait(1)
print("nok")
--local --

local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
print(RemoteEvent)
RemoteEvent.OnClientEvent:Connect(function(part)
	print("ok")
end)


this worked

1 Like

:WaitForChild(), I used that too.
server

client

not child, character.

cuz the server get set up first it will then fire the remoteevent before the player sets up his connect.
the player is still loading the game while the remote event gets fired

or any other delay that waits for the player to stop loading

I have added a delay (4 seconds) before the FireAllClients function, but somehow the script prints “nok” right after clicking play. Still didn’t worked, I don’t know what is the problem…

send us the latest version of the scripts

Script
--ReplicatedStorage stuff
local GameFunctionsModule = game:GetService("ReplicatedStorage"):WaitForChild("GameFunctions")
local RemoteEvent = game:GetService("ReplicatedStorage"):FindFirstChild("RemoteEvent")
--Model variables
local Model = workspace:WaitForChild("PlayerCharacter")
local HeadCamera = Model.Head
local SecondCamera = Model.SecondCamera
local ModelAnimator = Model:WaitForChild("MAIN_HUMANOID"):WaitForChild("Animator")
--Animation
local Animation = ModelAnimator:LoadAnimation(script:WaitForChild("Animation"))
--Play animation
Animation:Play()
--Tower smoke turning red; for animation event #1
local RedCK = {
	--API: ColorSequenceKeypoint.new(time, color)
	ColorSequenceKeypoint.new( 0, Color3.fromRGB(255,0,0)),
	ColorSequenceKeypoint.new(.5, Color3.fromRGB(255,0,0)),
	ColorSequenceKeypoint.new( 1, Color3.fromRGB(255,0,0))
}
local RedCS = ColorSequence.new(RedCK)
local TowerSmoke = workspace.NotNecessary.Lyoko.InsideActivatedTower.Smoke.ParticleEmitter
Animation:GetMarkerReachedSignal("TurnTowerSmokeRed"):Connect(function(paramString)
	TowerSmoke.Color = RedCS
end)
--Functions
wait(4)
RemoteEvent:FireAllClients(SecondCamera)
print("nok")
Local script
--CoreUI elements
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
--Player
local Player = game:GetService("Players").LocalPlayer
--Model
local Model = workspaceF:indFirstChild("PlayerCharacter")
local HeadCamera = Model.Head
local SecondCamera = Model.SecondCamera
--ReplicatedStorage stuff
local GameFunctionsModule = game:GetService("ReplicatedStorage"):WaitForChild("GameFunctions")
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
--Camera
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
--Functions
RemoteEvent.OnClientEvent:Connect(function(part)
	print("ok")
	game:GetService("RunService").RenderStepped:Connect(function()
		Camera.CFrame = part.CFrame
	end)
end)

Here.

where is the local script located?

Local script located inside StarterGui.


Server script is located in ServerScriptService.

theres a typo in your script in the line:

local Model = workspaceF:indFirstChild("PlayerCharacter")
1 Like

Well, even if I fixed that, it still won’t work. I am so confused.

Where is the local script located within the explorer?