Remote event not firing from server to client

I am currently working on a Rooms Fangame and I have just setup a system that causes the screen to go red and blurry upon death similar to the original. The way this is setup is used by a remote event that fires on-server to client upon player death. But most of the time, the remote event does not fire, and I have no clue why. If someone could help in any way, please let me know what went wrong here, Thanks!

Client:

local Died = game:GetService("ReplicatedStorage").RemoteEvents.PlayerDied

local function ThyEndIsNow()
	local TS = game:GetService("TweenService")
	local Blur = game:GetService("Lighting").Blur
	local RedEffect = game:GetService("Lighting").RedEffect
	Blur.Enabled = true
	RedEffect.Enabled = true
	game.Lighting.Ambient = Color3.fromRGB(255, 255, 255)

	task.wait(2)

	TS:Create(Blur, TweenInfo.new(5), {Size = 0}):Play()
	TS:Create(RedEffect, TweenInfo.new(5), {TintColor = Color3.fromRGB(255, 255, 255)}):Play()
	TS:Create(RedEffect, TweenInfo.new(5), {Saturation = -1}):Play()
	TS:Create(RedEffect, TweenInfo.new(5), {Contrast = 1}):Play()
	TS:Create(RedEffect, TweenInfo.new(5), {Brightness = 0}):Play()
end

Died.OnClientEvent:Connect(function()
	print("Functional")
	ThyEndIsNow()
end)

Server:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Plr)
	Plr.CharacterAdded:Connect(function(Character)
		local Hum = Character:FindFirstChild("Humanoid")
		Hum.Died:Connect(function()
			local Event = game:GetService("ReplicatedStorage").RemoteEvents:FindFirstChild("PlayerDied")
			Event:FireClient(Plr)
		end)
	end)
end)
1 Like

The player can detect their own death, y’know :eyes:

1 Like

Have you tried using a print in the line above or below the :FireClient?

1 Like

I know that, but the reason why I have it done like that is for the player to respawn instantly, like in the original rooms, which can (as far as I’m aware) only be done on the server

1 Like

I’ve done this already, but it does not print anything.

2 Likes

Players.PlayerAdded:Connect(function(Plr)
	print("a")
	Plr.CharacterAdded:Connect(function(Character)
		print("b")
		local Hum = Character:FindFirstChild("Humanoid")
		Hum.Died:Connect(function()
			print("c")
			local Event = game:GetService("ReplicatedStorage").RemoteEvents:FindFirstChild("PlayerDied")
			Event:FireClient(Plr)
			print("d")
		end)
	end)
end)

see how far the print statements work for

1 Like

This one seems to work the best so far, but sometimes a is the only one that prints

by “sometimes” do you mean after you reset

Yes, after reseting, most of the time all print statements work as intended, and sometimes only letter a prints

Can you print what its getting on the client side?

Even if i send the player though the same event, its not printing on the client either

Sometimes the timing of things are funky, like the character may be loaded before it gets to that CharacterAdded function. Especially if you have other things initializing early on.

Try doing this for the client

local function ThyEndIsNow()
   local TS = game:GetService("TweenService")
   local Blur = game:GetService("Lighting").Blur
   local RedEffect = game:GetService("Lighting").RedEffect
   Blur.Enabled = true
   RedEffect.Enabled = true
   game.Lighting.Ambient = Color3.fromRGB(255, 255, 255)

   task.wait(2)

   TS:Create(Blur, TweenInfo.new(5), {Size = 0}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {TintColor = Color3.fromRGB(255, 255, 255)}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {Saturation = -1}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {Contrast = 1}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {Brightness = 0}):Play()
end

Died.OnClientEvent:Connect(ThyEndIsNow)

This one doesn’t seem to function properly either.

I forgot to add the first line, try this


local Died = game:GetService("ReplicatedStorage").RemoteEvents.PlayerDied

local function ThyEndIsNow()
   local TS = game:GetService("TweenService")
   local Blur = game:GetService("Lighting").Blur
   local RedEffect = game:GetService("Lighting").RedEffect
   Blur.Enabled = true
   RedEffect.Enabled = true
   game.Lighting.Ambient = Color3.fromRGB(255, 255, 255)

   task.wait(2)

   TS:Create(Blur, TweenInfo.new(5), {Size = 0}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {TintColor = Color3.fromRGB(255, 255, 255)}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {Saturation = -1}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {Contrast = 1}):Play()
   TS:Create(RedEffect, TweenInfo.new(5), {Brightness = 0}):Play()
end

Died.OnClientEvent:Connect(ThyEndIsNow)

This works 100% of the time, thanks!