How to make a "YOU KILLED.." Gui

I have already made a gui that tells you who youve been killed by but it does not tell the killer who they killed. Would it be a simple change/fix?

game.Players.PlayerAdded:connect(function(Player)

Player.CharacterAdded:connect(function(Character)

Character.Humanoid.Died:connect(function()

local Tag = Character.Humanoid:FindFirstChild("creator")

if Tag ~= nil then

local Gui = script.KillGui:Clone()

Gui.Parent = Player.PlayerGui --Put this first

Gui.TopFrame.TextLabel.Text = ""..Tag.Value.Name..""

end

end)

end)

end)
7 Likes

Detecting who the player has killed depends on how you manage killing players in the game.

Is this a weapon? If so then I suggest reading through the code for this weapon and locating the section where it handles the opponent being damaged/killed.

3 Likes

No this is a gui with a script in it

3 Likes

If I understand correctly, you want the killer to know the name of his victim. This is quite easy to do. (I did not check, but it should be something like this)

humanoid.Died:Connect(function() -- humanoid = killed hum
 local killer = humanoid:findFirstChild("creator").Value -- killer
 local gui = script.KillGui:Clone()-- your GUI
 gui.Parent = killer.PlayerGui
 gui.TopFrame.TextLabel.Text = "You killed: "..humanoid.Parent.Name --name of the character
end)
1 Like

This is only if the weapon adds the creator tag to the humanoid.

While common practice in default Roblox tools, it’s fairly uncommon in customly created tools.

Case and point: make sure you have the weapon add a creator tag to the humanoid if you go this method!

I understand, I wrote a script based on the provided, as I understand it, the “creator” value already existed (see the provided script)