PCwienerJoin Date: 2007-03-03 Post Count: 3746 |
print("LB LOADED")
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local pnts = Instance.new("IntValue")
pnts.Name = "Points"
pnts.Value = 0
local gm = Instance.new("IntValue")
gm.Name = "Game"
gm.Value = 0
pnts.Parent = stats
gm.Parent= stats
stats.Parent = newPlayer
end
function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
humanoid= player.Character:findFirstChild("Humanoid")
local g = stats:findFirstChild("Game")
g.Value = 0
humanoid.Died:connect(function() onHumanoidDied(humanoid, player) end )
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
--------------------------------------
output found nothing...
|
|
gameheroJoin Date: 2007-06-12 Post Count: 1455 |
I think it's cause there's nothing outside the funtion that tells onHumanoidDied to run, so it wont bring it up in the output. Nor will it work. |
|
PCwienerJoin Date: 2007-03-03 Post Count: 3746 |
how do you suggest i fix that? :) |
|
AnaminusTop 100 PosterJoin Date: 2006-11-29 Post Count: 5945 |
print("LB LOADED")
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local pnts = Instance.new("IntValue")
pnts.Name = "Points"
pnts.Value = 0
local gm = Instance.new("IntValue")
gm.Name = "Game"
gm.Value = 0
pnts.Parent = stats
gm.Parent= stats
stats.Parent = newPlayer
humanoid.Died:connect(function() onHumanoidDied(humanoid, player) end )
end
function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
humanoid= player.Character:findFirstChild("Humanoid")
local g = stats:findFirstChild("Game")
g.Value = 0
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
-------------------------------------------------------------
You're Died event is in the wrong function.
?-Anaminus-? |
|
slosoTop 100 PosterJoin Date: 2007-05-08 Post Count: 634 |
Mwhahaha! PCwiener was i need of help then anamuis came |
|
CPRULEZTop 100 PosterJoin Date: 2007-05-29 Post Count: 3093 |
*sigh* of course Anaminus kno's the script.......... *sigh* |
|
gameheroJoin Date: 2007-06-12 Post Count: 1455 |
I knew that part was supposed to go in a different funtion or outside of it, but I didn't think of that... Silly me. XD |
|
PCwienerJoin Date: 2007-03-03 Post Count: 3746 |
i think the problem now is the character arrives after the player... i looked at a couple other scripts and tryed to fix it, i failed :).
-----------
print("LB LOADED")
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local pnts = Instance.new("IntValue")
pnts.Name = "Points"
pnts.Value = 0
local gm = Instance.new("IntValue")
gm.Name = "Game"
gm.Value = 0
pnts.Parent = stats
gm.Parent= stats
stats.Parent = newPlayer
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end
humanoid= newPlayer.Character:findFirstChild("Humanoid")
Character= newPlayer.Character
humanoid.Died:connect(function() onHumanoidDied(humanoid, player) end )
end
function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
local g = stats:findFirstChild("Game")
g.Value = 0
end
end
game.Players.ChildAdded:connect(onPlayerEntered) |
|
slosoTop 100 PosterJoin Date: 2007-05-08 Post Count: 634 |
HAHA i copyed your script!!!!!!!!!!!!!!!!!!!!!!!!!!
just kiddin
[sloso] |
|
PCwienerJoin Date: 2007-03-03 Post Count: 3746 |
lol it doesnt work... |
|
CPRULEZTop 100 PosterJoin Date: 2007-05-29 Post Count: 3093 |
............huh? |
|
AnaminusTop 100 PosterJoin Date: 2006-11-29 Post Count: 5945 |
humanoid.Died:connect(function() onHumanoidDied(humanoid, player) end )
changes to
humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )
?-Anaminus-? |
|
PCwienerJoin Date: 2007-03-03 Post Count: 3746 |
thanks ana, worked like a charm :) |
|
|