Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I find the player who killed another player? [closed]

Asked by 9 years ago

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!"?

Closed as Not Constructive by NinjoOnline, Goulstem, Redbullusa, and EzraNehemiah_TF2

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 9 years ago

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)
Ad
Log in to vote
-6
Answered by 9 years ago
tjjj