For an example, If I killed ROBLOX in a game how do I make it so that when I do kill them the output says "AllianceScripter Killed ROBLOX!"?
COMMUNITY QUESTION
How would I find the player who killed another player?
2 answers
Let's say that you killed them with a Sword, you would use two StringValues that are inside of this Sword, and inside this Sword was a LocalScript, inside this you would insert this code:
Tool = script.Parent
PlayerNameValue = Tool.[Name Of StringValue]
PlayerNameValue.Value = game.Players.LocalPlayer.Name
OtherPlayerName = Tool.[Name Of StringValue]
Tool.Handle.Touched:connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if (Humanoid) then
OtherPlayerName.Value = hit.Parent.Name
Humanoid.Changed:connect(function()
if Humanoid.Health == 0 then
print(PlayerNameValue.Value.." killed "..OtherPlayerName.Value.."!")
end
end)
end
end)
tjjj
This discussion is preserved as it was. New answers, comments, and votes are closed.
