--Actual script

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
if script:FindFirstChild("SendDeathMessage") and script:FindFirstChild("DeathMessage") then
script:FindFirstChild("SendDeathMessage").Parent = game.ReplicatedStorage
script:FindFirstChild("DeathMessage").Parent = game.StarterGui
if player.Character:FindFirstChild("Humanoid") then
local hum = player.Character:FindFirstChild("Humanoid")
hum.Died:Connect(function()
local DeathMessage = DeathMessages[math.random(1,#DeathMessages)]
local Users = game.Players:GetChildren()
for i, User in pairs(Users) do
if game.ReplicatedStorage:FindFirstChild("SendDeathMessage") then
game.ReplicatedStorage.SendDeathMessage:InvokeClient(User, player.Name .. " " .. DeathMessage)
end
end
end)
end
elseif game.ReplicatedStorage:FindFirstChild("SendDeathMessage") and game.StarterGui:FindFirstChild("DeathMessage") then
if player.Character:FindFirstChild("Humanoid") then
local hum = player.Character:FindFirstChild("Humanoid")
hum.Died:Connect(function()
local DeathMessage = DeathMessages[math.random(1,#DeathMessages)]
local Users = game.Players:GetChildren()
for i, User in pairs(Users) do
if game.ReplicatedStorage:FindFirstChild("SendDeathMessage") then
game.ReplicatedStorage.SendDeathMessage:InvokeClient(User, player.Name .. " " .. DeathMessage)
end
end
end)
end	
end
end)
end)
