scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 08:47 PM |
The output says that H is a nil value, yet It was given a purpose right before.
Human = Player.Name H = Workspace:findFirstChild(Human) H.Died:connect(function() Dead(Human, Player) end) |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 14 Apr 2012 08:48 PM |
| if H == nil then return end |
|
|
| Report Abuse |
|
|
scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 08:54 PM |
function Join(Player) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player
local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0
Human = Player.Name H = Workspace:findFirstChild(Human) if H == nil then return end H.Died:connect(Dead) end
Is this how i would put it? Should I move something, because my game wont recognize that someone has died. |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 14 Apr 2012 08:54 PM |
| Give it time for the character to load first. |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 14 Apr 2012 08:55 PM |
while true do wait(5) if H == nil then return end end |
|
|
| Report Abuse |
|
|
scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 08:55 PM |
| How much time? would 10 seconds be enough? |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 14 Apr 2012 08:56 PM |
function Join(Player) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player
local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0
Human = Player.Name H = Workspace:findFirstChild(Human)
while true do wait(5) if H == nil then return end end
H.Died:connect(Dead) end
|
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
| |
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 14 Apr 2012 08:57 PM |
function Join(Player) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player
local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0
Human = Player.Name H = Workspace:findFirstChild(Human)
while true do wait(5) if H == nil then return else break end end
H.Died:connect(Dead) end
|
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:05 PM |
OR somthing better:
function Join(Player) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0 Player.CharacterAdded:connect(function(char) char:FindFirstChild("Humanoid").Died:connect(Dead) end
† KMXD † |
|
|
| Report Abuse |
|
|
scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 09:10 PM |
So, It still wont acknowledge that Ive died, ive started messing around and using prints but it wont reach the point of starting the dead function
Here's what I added, it wont reach the spot that says "done looping", do you know why?
function Join(Player) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player
local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0
Human = Player.Name H = Workspace:findFirstChild(Human) while true do print "here" wait(5) print "done" if H == nil then return print "looping" end print "done looping" -- It will not print this H.Died:connect(Dead) end end |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:12 PM |
Oops.
Game.Players.PlayerAdded:connect(function(Player) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0 Player.CharacterAdded:connect(function(char) char:FindFirstChild("Humanoid").Died:connect(Dead) end) end)
† KMXD † |
|
|
| Report Abuse |
|
|
scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 09:16 PM |
| So I tried your script as well, it says it needs a closing parenthesis, and when I put it in, it said there was an unexpected symbol where I put it, which was right after (Dead) |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 14 Apr 2012 09:18 PM |
| Why not keep my less-efficient script for a backup? |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:21 PM |
| Can we see the Dead function? I believe the problem must be in that. |
|
|
| Report Abuse |
|
|
scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 09:23 PM |
Heres the Dead function
function Dead(Human, Player) stats = Player:findFirstChild("leaderstats") if stats ~= nil then if Alive ~= nil then Alive:remove() end end end |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:27 PM |
Alright, try this:
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(char) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0 local humanoid = char:FindFirstChild("Humanoid") if humanoid then humanoid.Died:connect(function() stats = Player:findFirstChild("leaderstats") if stats ~= nil then if Alive ~= nil then Alive:remove() end end end) end end) end) |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:31 PM |
| And get rid of the Dead function, it's taken care of now. |
|
|
| Report Abuse |
|
|
scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 09:31 PM |
| I would say thanks, but even it didnt work... This is really starting to frustrate me, I dont know how far it got, but it did not remove the "Alive", and upon respawn I got another leaderstats. |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:32 PM |
@Electric
Wouldn't that make more IntValues, everytime you die?
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:33 PM |
Did you define stats and Alive?
Game.Players.PlayerAdded:connect(function(Player) local l = Instance.new("IntValue") l.Name = "leaderstats" l.Parent = Player local p = Instance.new("IntValue") p.Name = "Points" p.Parent = l p.Value = 0 Player.CharacterAdded:connect(function(char) local humanoid = char:FindFirstChild("Humanoid") if humanoid then humanoid.Died:connect(function() stats = Player:findFirstChild("leaderstats") if stats ~= nil then if Alive ~= nil then Alive:remove() end end end) end end) end)
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:35 PM |
@KnightmareXD -
humanoid.Died:connect(function() stats = Player:findFirstChild("leaderstats") if stats ~= nil then if Alive ~= nil then Alive:remove() end end end)
Where in that does it add more leaderstats? I copied his dead function into that. |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:36 PM |
You put the characteradded event before instancing the intvalues.
† KMXD † |
|
|
| Report Abuse |
|
|
scripteer
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 67 |
|
|
| 14 Apr 2012 09:37 PM |
| oh, my, god, I feel so stupid for not noticing that, you pointed it out, I had it just written as Alive, where is should have been Player.Alive. |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2012 09:40 PM |
| @KnightmareXD - Oh, now that you've rephrased it, I see it. Sorry, when you said "died", I thought you were referring to the Died event, not the CharacterAdded one. |
|
|
| Report Abuse |
|
|