LV1Z
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 652 |
|
|
| 08 Oct 2012 12:11 PM |
function death(humanoid, player) print(humanoid) print(player) local stats = player:FindFirstChild("leaderstats") if stats ~= nil then local deaths = stats:FindFirstChild("Deaths") deaths.Value = deaths.Value + 1 local killer = getKillerOfHumanoidIfStillInGame(humanoid) kills() end end
-- Humanoid and player are not nil --
when I call the function, its prints 2 nil's then it says : attempt to call a nill value 'humanoid' |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2012 12:12 PM |
| Stop double-posting. And find it before running it. |
|
|
| Report Abuse |
|
|
LV1Z
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 652 |
|
| |
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 08 Oct 2012 12:14 PM |
function death(humanoid, player) --[[ you need to define humanoid when the function is activated]] print(humanoid) -- Not defined right now. print(player) -- Same local stats = player:FindFirstChild("leaderstats") if stats ~= nil then local deaths = stats:FindFirstChild("Deaths") deaths.Value = deaths.Value + 1 local killer = getKillerOfHumanoidIfStillInGame(humanoid) kills() end end |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2012 12:15 PM |
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(character) function death(humanoid, player) player = plr humanoid = character.Humanoid local stats = player:FindFirstChild("leaderstats") if stats ~= nil then local deaths = stats:FindFirstChild("Deaths") deaths.Value = deaths.Value + 1 local killer = getKillerOfHumanoidIfStillInGame(humanoid) kills() end end end) end) |
|
|
| Report Abuse |
|
|