local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ChatNotification = ReplicatedStorage.Events:WaitForChild('ChatNotification')
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if character:WaitForChild("Humanoid").Health < 1 then
local Message = player.Name .. "has been killed."
ChatNotification:FireAllClients(Message)
end
end)
end)
LocalScript located in StarterPlayerScripts
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ChatNotification = ReplicatedStorage.Events:WaitForChild('ChatNotification')
local textColor = BrickColor.new('Maroon')
ChatNotification.OnClientEvent:Connect(function(Message)
game.StarterGui:SetCore('ChatMakeSystemMessage', {
Text = Message,
Font = Enum.Font.SourceSansBold,
Color = textColor.Color,
FontSize = Enum.FontSize.Size24
})
end)
It doesn’t send any errors but it doesn’t send any messages in the chat
I noticed here you are only checking the humanoid’s health once, you could try using the humanoid.Died event or humanoid:GetPropertyChangedSignal("Health").
Like I said, you are only checking the humanoid’s health once. You need to check when it dies.
humanoid.Died:Connect(function()
print(`@{player.Name} has died.`)
end)
--or
humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if humanoid.Health == 0 then
print(`@{player.Name} has died.`)
end
end)
That is not correct. The Health property can be accessed from the server, of course if the damage is not applied on the server it would not replicate to the server, but even then it would be way more efficient to manage damage on the server rather than use a ton of remotes (which would be exploitable anyway).
I tested in studio applying damage on the server and then printing from the server and it all worked just fine.
ChatMakeSystemMessage only works with TextChatService.ChatVersion set to LegacyChatService.
The newer (and default) chat system is TextChatService where ChatMakeSystemMessage is unsupported.
I would first check if it just works itself, then try to set it up when player died
So I suggest to check if it sending message if you just try to activate it without player dying
(I guess just fire remote?)