|
while wait() do
for i,v in pairs(game.Players:getPlayers()) do
if v.Character.Humanoid.Health == 0 or v:FindFirstChild("Alive").Value == false then
v:FindFirstChild("Alive").Value = false
wait(7)
---MY CODE WOULD BE HERE
end
end
end
For some reason, this works once and then it doesn't work again. So let's say I die this code works, then if I die again it doesn't work. Why does this occur? |
|
|
|
|
|
PoseidasJoin Date: 2008-11-23 Post Count: 2659 |
better plan:
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
Character.Humanoid.Changed:connect(function(change)
if Humanoid.Health <= 0 then
wait(7)
--Insert code here
end
end)
end)
end)
Much more efficient bro. K. |
|
|
So would this fix the issue? |
|
PoseidasJoin Date: 2008-11-23 Post Count: 2659 |
Just change anything in the "--MY CODE WOULD BE HERE" Bit that has "v.Character" to just "Character" and you should be good. Oh, but the "Alive" value is not needed now. |
|
PoseidasJoin Date: 2008-11-23 Post Count: 2659 |
If for some reason you need the alive value, then here:
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
Character.Humanoid.Changed:connect(function(change)
if Humanoid.Health <= 0 then
Player.Alive.Value = false
wait(7)
--Insert code here
end
end)
end)
end) |
|
|
Wait, I am a little confused. It's not working. |
|
PoseidasJoin Date: 2008-11-23 Post Count: 2659 |
Well you do have to modify the rest of your code to work with it. |
|
|
Nope. Tested and doesn't work |
|
|
Wrong Fourm, Go to the scripting fourm |
|
|
@ColdUndermined
This is the right forum since SH and BH got removed. Scripters isn't for help requests, just anything that is scripting and isn't a help request. |
|
|
Actually, Everyone asks for help on Scripting fourm, SH was merged with it. |
|
PoseidasJoin Date: 2008-11-23 Post Count: 2659 |
To my knowledge, SH and BH merged here. To make a game (ie "Game Design") you need to know how to build AND script. |
|
|
|