|
| 03 Apr 2012 06:10 AM |
function onPlayerEntered(player) if player.Humanoid == true then while true do player.Character:FindFirstChild("Humanoid").Health = player.leaderstats.Hunger.Value end end end game.Players.ChildAdded:connect(onPlayerEntered)
So what happens is For every player that enters the game A looped function starts so that their health is always the same as their hunger (Which is on the leaderboard) |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 06:11 AM |
Output says that "Humanoid is not a valid member of Player" Player being the person in the game But it is a valid member.
|
|
|
| Report Abuse |
|
|
| |
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 06:30 AM |
function onPlayerEntered(player) if player.Character.Humanoid == true then --You missed character here. while true do player.Character:FindFirstChild("Humanoid").Health = player.leaderstats.Hunger.Value end end end game.Players.ChildAdded:connect(onPlayerEntered)
|
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 06:46 AM |
Oh yeah, thanks Cheater You rock :D! |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 06:47 AM |
Output now says
Workspace.Health-Hunger:2: attempt to index field 'Character' (a nil value) |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 06:50 AM |
wait(5) --Sometimes it laggs and the scripts starts before the character is even in the game
function onPlayerEntered(player) if player.Character.Humanoid == true then while true do player.Character:FindFirstChild("Humanoid").Health = player.leaderstats.Hunger.Value end end end game.Players.ChildAdded:connect(onPlayerEntered)
|
|
|
| Report Abuse |
|
|
| |
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 06:54 AM |
wait(5)
function onPlayerEntered(player) if player.Character.Humanoid ~= nil then --Maybe nil instead of true? while true do player.Character:FindFirstChild("Humanoid").Health = player.leaderstats.Hunger.Value end end end game.Players.ChildAdded:connect(onPlayerEntered)
|
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 06:56 AM |
One thing, you know this will only be like this until the player dies and if the Hunger Value is over 100 it doesn't change at all. Also the player will refresh its health automatically.
Anyways, is that scirpt called "Health-Hunger"? |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 06:57 AM |
Lol, exactly that. And in the leaderstats script when you die it automatically resets to 100 And after I've built the place I'll add something that means if it's over 100 it will revert back to 100. |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 06:58 AM |
| Does the Hunger Value change in time and should the health always be like the Hunger Value or what is it supposed to do? |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
|
| 03 Apr 2012 07:03 AM |
When I press the Play Solo button in Test The hunger [leaderboard] goes down But when I check the explorer My health doesn't |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 07:05 AM |
Drop this script into StarterGui:
wait(5)
c = script.Parent.Parent.Character
c.Humanoid.MaxHealth = script.Parent.Parent.leaderstats.Hunger.Value --This will lower or raise the health to it c.Humanoid.Health = script.Parent.Parent.leaderstats.Hunger.Value --Optional, if the health goes over 100, this will be quicker regened --c.Health:remove() --Remove the two -- at the beginning so it won't regen the health
|
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 07:07 AM |
| Wait a second, so you want the health always be like hunger? |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Apr 2012 07:10 AM |
Yes, I do. Darn you, floodcheck, I'll boil your guts and feed them to my pet unicorn who will proceed to breathe fire in your centre so you die a slow and painful death. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
| |
|
| |
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 07:17 AM |
If you want the health always be like "Hunger":
wait(5)
c = script.Parent.Parent.Character
--c.Humanoid.MaxHealth = 0 --remove the two -- and change the 0 to the number, the player can maximal recieve of health, else it will be at 100 while true do --c.Humanoid.MaxHealth = script.Parent.Parent.leaderstats.Hunger.Value --remove the two -- and the max health will also be like "Hunger", you wan't really notice how much health you have because you can't see a number. c.Humanoid.Health = script.Parent.Parent.leaderstats.Hunger.Value end c.Health:remove() |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 03 Apr 2012 07:17 AM |
| Also drop this into StarterGui. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 07:18 AM |
Ooh ooh
C means the character, right
Well Health isn't in the character It's in the Humanoid :D! |
|
|
| Report Abuse |
|
|