Event wont fire to the client

  1. What do you want to achieve? Keep it simple and clear!

so i want to make an intermission system but somehow the event on the server code wont fire

  1. What is the issue? Include screenshots / videos if possible!

the first fireallclient line was not fired somehow

SERVER CODE:

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local gameEvent = ReplicatedStorage:WaitForChild("GameEvent")

local Settings = require(script.GameSettings)

local intermission = true

while true do
	intermission = true
	
	-- the event that wont fire
	gameEvent:FireAllClients(intermission)
	
	task.wait(Settings.IntermissionTime)
	intermission = false
	
	gameEvent:FireAllClients(intermission)
	
	task.wait(Settings.InGameTime)
end

CLIENT CODE:

local RS = game:GetService("ReplicatedStorage")

local gameEvent = RS:WaitForChild("GameEvent")

local camera = workspace.CurrentCamera
local campart = workspace:WaitForChild("Campart")
local connection
local renderconnection
local Intermission = true

connection = camera:GetPropertyChangedSignal("CameraType"):Connect(function()
	if camera.CameraType ~= Enum.CameraType.Scriptable then
		camera.CameraType = Enum.CameraType.Scriptable
	end
end)

renderconnection = game:GetService("RunService").RenderStepped:Connect(function()
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = campart.CFrame
end)

gameEvent.OnClientEvent:Connect(function(intermission)
	if intermission == false then
		print(intermission)
		
		Intermission = intermission
		
		connection:Disconnect()
		renderconnection:Disconnect()
		
	elseif Intermission == true then
		Intermission = intermission
		print(intermission)

		connection = camera:GetPropertyChangedSignal("CameraType"):Connect(function()
			if camera.CameraType ~= Enum.CameraType.Scriptable then
				camera.CameraType = Enum.CameraType.Scriptable
			end
		end)

		renderconnection = game:GetService("RunService").RenderStepped:Connect(function()
			camera.CameraType = Enum.CameraType.Scriptable
			camera.CFrame = campart.CFrame
		end)
	end
end)

thanks for your help :wink:

1 Like

This is most likely because you joined the game after :FireAllClients is called

Maybe it’s because in the client if statement you’re checking
“elseif Intermission == true then” instead of
“elseif intermission == true then” with lowercase I.

that works but the camera still wont change to the camparts cframe

So what is the issue now? Is your event being fired correctly?

yes but the camera isnt positioned to the destined part cframe

it didnt run the renderstepped function