Dearth Message problem

ServerSideScript located in ServerScriptService

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 need help on this scrip,t please.

I noticed here you are only checking the humanoid’s health once, you could try using the humanoid.Died event or humanoid:GetPropertyChangedSignal("Health").

1 Like

The problem is that the message doesn’t appear in the chat and there is no output error as I said in the main message

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)

u can only check the humanoid’s health on a localscript

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.


And still nothing (after resetting)

ChatMakeSystemMessage only works with TextChatService.ChatVersion set to LegacyChatService.
The newer (and default) chat system is TextChatService where ChatMakeSystemMessage is unsupported.

1 Like
if character:WaitForChild("Humanoid").Health < 1 then
	local Message = player.Name .. "has been killed."
	ChatNotification:FireAllClients(Message)
end

You checking it once
Try using

character:WaitForChild("Humanoid").Died:Connect(function()
--Do whatever you want here
end)

Yeah already did that but thanks

@wf_sh made a good spot! You are using the new TextChatService, so you need to do this:

game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage(message)

because, like they said, ChatMakeSystemMessage is not supported in the new chat.


I already mentioned that.

1 Like

Oh, sorry, I didn’t read messages that was in this post
@12345koip ^

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

i meant about the propertygetsingal or .died

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.