I wrote some code for a server chat but it does no replicate for all servers. Its supposed to be a chat that when a player died every one should be able to see it. The problem is that I tested it and only I can see the server death chat when I die. So, everyone can only see their death messages not anyone’s in the server. Here is my code:
--in a local script
game.Lighting.Blur.Size = 0
local player = game.Players.LocalPlayer
wait(2)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local frame = script.Parent.Frame
local sm
local messages = {
" kicked the can.",
" couldn't make it.",
" is dead.",
" has vanished.",
" is not spoken of.",
" disappeared.",
" met adversity.",
}
humanoid.Died:Connect(function()
sm = BrickColor.new ("Crimson")
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = player.Name .. messages[math.random(1, #messages)];
Font = Enum.Font.ArialBold;
Color = sm.Color;
FontSize = Enum.FontSize.Size96;
})
script.Parent.Between:Play()
frame.BackgroundTransparency = 0
frame.Visible = true
for i = 0, 1, 0.01 do
frame.BackgroundTransparency = i
wait(0.2)
end
frame.Visible = false
frame.BackgroundTransparency = 1
end)
humanoid.HealthChanged:Connect(function(newHealth)
game.Lighting.Blur.Size = 56-newHealth
end)
I’m sorry I meant to say that its not replicating on all clients. Its like in SCP-3008 when you die it chats that the player died. For me, its not working.
Alrighty, what you could do instead is use a PlayerAdded event on the server side & detect when a Character will die that way, you could probably something like this:
--Server Script inside ServerScriptService
local sm
local messages = {
" kicked the can.",
" couldn't make it.",
" is dead.",
" has vanished.",
" is not spoken of.",
" disappeared.",
" met adversity.",
}
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
sm = BrickColor.new ("Crimson")
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = player.Name .. messages[math.random(1, #messages)];
Font = Enum.Font.ArialBold;
Color = sm.Color;
FontSize = Enum.FontSize.Size96;
})
end)
end)
end)
This should work so that all players can see the message