How to make a global death message system?

I’m trying to make a global death message system for every servers.i started writing when i read the documentation.but then i got stuck on something.
script:

local DB = false
local DSS = game:GetService("DataStoreService"):GetDataStore("Ban")

game:GetService("Players").PlayerAdded:Connect(function(Plr)
	local IsBanned = DSS:GetAsync(Plr.UserId)
	if IsBanned then
		Plr:Kick("A̷͖̳͊-̷̦͚̄A̸̱͊m̷̝͋ ̶̻́i̵͍͖͠ ̴͔͘l̶̟̓̓i̵̫͗͋v̷̛͇̱͊i̵͉͂͜͝n̶͍̓͊g̴̱̈́?̸̘͔͠ ̶͍̿o̶̱͎͂̿h̶̬̮͒̇ ̵͉́m̶̝͝y̷͙̙͘ ̴̣̻̑g̶̦̑o̷̭͊̽s̸͍̈́̿h̸̼͑.̶̟͊t̸̝͎̿h̸̯́ͅi̷̢̝͒s̸͇͎̉ ̸̡̝̀͋ĭ̸̪͎s̸̢̲̎͆.̵͎̆̃͜.̴͎̩̌.̵̡́ ̵̺̓n̴̲̈́o̵̤͆̋t̷͖̙̄ ̶̢̇̀c̵͕̈ỏ̷̫̿o̷̡͑́l̴̜̥̽͒.̵̜͆i̶̮̱̓-̶͈͉̔i̸͙̎ ̸̯̤͝w̸͇̓͜ḭ̶̾͘l̸̟̳̅̿l̸̝̉ ̵̘̗̈́̈́n̷͈̍e̴͇͌̓v̶̫̀ȇ̷͓͝r̴̩̓ ̸̯̩͋b̵̗͝e̴̜͉͝ ̷̧̍̒ö̷̱͕̅n̸̠̙͝ ̴͎̱̿̒t̵̩̘͘ḫ̸̒̀ȉ̷̖s̶̘͓̑̓ ̸̙͐̎g̶̡̀a̴͇̐-̶͇̫̓̉g̵̗̑̐a̶̼̅̚m̸̖̄͘ė̴̦͇̕ ̴̘̎͊ā̶͍-̶͕͊̓a̵̡̱͊͝g̴̦͑a̸̮̓̓i̴̠̽n̸̹̈́͝.̸̛̪̟͠")
	end
end)

script.Parent.Touched:Connect(function(Hit)
	if DB then
		return
	end
	DB = true
	if Hit and Hit.Parent and Hit.Parent:FindFirstChildWhichIsA("Humanoid") then
		game:GetService("SoundService").Bonebreak:Play()
		Hit.Parent.Humanoid.BreakJointsOnDeath = false
		Hit.Parent.Humanoid.Health = 0
		game:GetService("SoundService").Ambience:Destroy()
		game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent).PlayerGui.Death.Enabled = true
		DSS:SetAsync(game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent).UserId,true)
		game:GetService("MessagingService"):PublishAsync("Vefat mesajı",{message = Hit.Parent.Name.." vefat etti.Geçmiş olsun :("})
		game:GetService("MessagingService"):SubscribeAsync("Vefat mesajı",function(receiveddata)
			local data = receiveddata.Data
			
		end)
	elseif Hit.Name == "Glass" then
		DB = false
		Hit:Destroy()
 	end
end)

game:GetService("Players").PlayerRemoving:Connect(function(Plr)
	DSS:SetAsync(Plr.UserId,true)
end)

i got stuck when changing every servers players textlabel text.

can someone help me with that?

You would have to move the Subscribe function outside of the touched event.

still didnt helped me for my issue.i wanted to change every servers players death message.

You can just make a table that has different strings that you want to appear as a death message then use math.random to generate a random index that has a string then access the index’s string by using the random generated index

Example:

local Table = { [1] = “This is a death msg”, [2] = “Second Death msg”}

local RandomIndex = math.random(1,#Table) – Get a random index
local IndexString = Table[RandomIndex] – Get The Index’s String

i was used that in my previous challenge game. it appears random 10 messages with the died players name.but still didnt helped me.

fixed some minutes ago.for the people who helped me didnt even helped a bit on my issue.but thats okay.

Probably because you keep setting the player’s hp to 0, you should’ve made it so it ignores players with 0 hp.

You read my messages?thats not the issue.i got stuck at sending global servers the death message message.

you also have read this?please no reply till you understood.

I don’t mean this in a rude way, but no one understood what you said in the first place

1 Like

oh.im sorry for that.never happen again :frowning: its because ima turkish man

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