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)
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
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.