|
| 27 Jul 2015 02:12 AM |
function Spawned(player) wait() if player:findFirstChild("leaderstats") ~= nil then player.leaderstats:remove() end
stats = Instance.new("IntValue") stats.Parent = player stats.Name = "leaderstats"
money = Instance.new("IntValue") money.Parent = stats money.Name = "Exp" money.Value = 1000
player.Character.Humanoid.MaxHealth = money.Value player.Character.Humanoid.Health = money.Value end
game.Players.PlayerAdded:connect(Spawned)
c = game.Players:GetChildren() for i=1, #c do Spawned(c[i]) end
~Why it doesn't work the way I want? It's suppose to change player health even after it's respawn, but it works only when the player first time enters the server, after death this script doesn't work. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 02:19 AM |
you need to run the function every time the Character's Humanoid dies, not loop it through all the players
that doesn't make any sense |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 27 Jul 2015 02:30 AM |
| Interesting how "supposed", the subjective substitute for the more objective "ought" is so much more often than not supplanted by the, nearly always incorrectly imposed, present perfect tensed, "suppose". |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 02:38 AM |
| I changed "Spawned" function to "onRespawn" nothing works. I still can't understand why. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 02:42 AM |
the name of the function literally doesn't matter, it doesn't effect anything
you need to call the function on the event that their Humanoid dies |
|
|
| Report Abuse |
|
|