The easiest way of doing this is creating a table. Youd then iterate through the table and find the player with the name "player2". The script would look like this:
local Humanoid = script.Parent.Humanoid
function killed()
local creator = script.Parent.Humanoid:FindFirstChild("creator")
local playerName = creator.Value
print(playerName)
players = game.Players:GetChildren()
for i,v in pairs(players) do
if v.Name == playerName then
player = v
return player
end
print(id)
local elo = id.ELO
elo.Value = elo.Value - 15
script:remove()
end
Humanoid.Died:connect(killed)
Here's an explanation. First we create a table. A table is a list of values that are stored in one variable. If you want to find one of the values within the table, we would iterate through the table. This means the lines of code within the "for i,v in pairs" will run. Then, if the value were on is equal to the PlayerName variable, then we index the player using the v. V stands for the value were using. Return, returns the value and allows you to grab it from anywhere in the script.
Hopefully this is a good enough start to your script. Of coarse I really don't expect you to do much with it :/. If you don't understand the concept, I have some links below. If you have any questions, please comment.
Tables: http://wiki.roblox.com/index.php?title=Table
An in-depth scripting guide: http://wiki.roblox.com/index.php?title=Scripting_Book
1 comment
Try replacing "FindFirstChild" with "WaitForChild", on "local id". If that doesn't work, replace all "FindFirstChild" to "WaitForChild".