|
| 11 Dec 2016 10:32 AM |
i dont understand why this not work
local Humanoid = script.Parent.Humanoid
function OnKill() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local leaderstats = tag.Value:findFirstChild("leaderstats") if leaderstats ~= nil then leaderstats.exp.Value = leaderstats.exp.Value + 1 wait(0.1) script:remove() end end end end
Humanoid.Died:connect(OnKill())
|
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Dec 2016 10:53 AM |
:Connect(OnKill)
not :connect(OnKill())
i'm not any more should not the panda and? |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 11:05 AM |
didnt work, and wouldnt it be a lowercase 'c' in ":connect"
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 11 Dec 2016 11:59 AM |
local players = game.Players local pp = game.Players:GetPlayers()
for i = 1,#pp do local humanoid = pp[i].Character:WaitForChild("Humanoid") humanoid.Died:Connect(function(deadplayer) local tag = humanoid:FindFirstChild("creator") if tag ~= nil and tag.Value ~= nil and tag.Value.Parent == players then if deadplayer.Parent ~= players then local killer = tag.Value local leaderstats = killer:FinidFirstChild("leaderstats") if leaderstats ~= nil then local expvalue = leaderstats:FindFirstChild("Exp") expvalue.Value = expvalue + 1 end end end) |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:00 PM |
local players = game.Players local pp = game.Players:GetPlayers()
for i = 1,#pp do local humanoid = pp[i].Character:WaitForChild("Humanoid") humanoid.Died:Connect(function(deadplayer) local tag = humanoid:FindFirstChild("creator") if tag ~= nil and tag.Value ~= nil and tag.Value.Parent == players then if deadplayer.Parent ~= players then local killer = tag.Value local leaderstats = killer:FinidFirstChild("leaderstats") if leaderstats ~= nil then local expvalue = leaderstats:FindFirstChild("Exp") expvalue.Value = expvalue + 1 end end end end end) |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:06 PM |
is the humanoid defined as the plr's humanoid or the npc(<-- want tht)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Dec 2016 12:20 PM |
| it is defined as the player's humanoid |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:23 PM |
the title says 'npc' ; would it work if i define the npc's humanoid instead
|
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:24 PM |
| there is a part in the script that checks ### ## what was killed. "if deadplayer.Parent ~= players then" this checks if the person who died parent is not "game.Players" or "Players" this will return true if the person who died's parent is not in "Players",it will return false if it is in "Players" |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 11 Dec 2016 12:34 PM |
both your previous piece of code and the one defining humanoid didn't work
|
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:37 PM |
does anyone know why this isnt working:
local Humanoid = script.Parent.Humanoid
function OnKill() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local leaderstats = tag.Value:findFirstChild("leaderstats") if leaderstats ~= nil then leaderstats.exp.Value = leaderstats.exp.Value + 1 wait(0.1) script:remove() end end end end
Humanoid.Died:connect(OnKill)
or any more solutions
|
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:43 PM |
| I don't think NPCs are tagged when they are hit with a weapon... |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:47 PM |
n how would i go about giving a player experience when killing an npc
|
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 12:48 PM |
| that depends on how your weapon script works. |
|
|
| Report Abuse |
|
|
Inigo18
|
  |
| Joined: 02 Feb 2014 |
| Total Posts: 1041 |
|
|
| 11 Dec 2016 12:56 PM |
did you get an error on output?
|
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 01:03 PM |
hing came up there (no errors)
|
|
|
| Report Abuse |
|
|
| |
|
Inigo18
|
  |
| Joined: 02 Feb 2014 |
| Total Posts: 1041 |
|
|
| 11 Dec 2016 01:37 PM |
then it's not an error. the problem is probably that if statements, why don't you add prints in each block to check if the script goes through or not?
|
|
|
| Report Abuse |
|
|