|
| 01 Sep 2013 09:05 AM |
I wrote this script, but I can't seem to get it to add extra MaxHealth. (So instead of changing the amount of MaxHealth, adding to the MaxHealth)
Anyone know how to fix this?
wait(2)
gpid = 128338642 health = MaxHealth + 50
GPS = Game:GetService("GamePassService") function respawned(char) player = game.Players:FindFirstChild(char.Name) print("Respawned") if char:FindFirstChild("Head") ~= nil then print("It's a Player!") if GPS:PlayerHasPass(player, gpid) then print("Has GPID") char.Humanoid.MaxHealth = health else print("No GPID") end end end game.Workspace.ChildAdded:connect(respawned)
|
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 09:10 AM |
"health = MaxHealth+50" Im pretty sure thats undefined, but If I'm wrong then sorry(Ive never written a variable like that). |
|
|
| Report Abuse |
|
|
stroudie
|
  |
| Joined: 28 Nov 2008 |
| Total Posts: 2556 |
|
|
| 01 Sep 2013 09:16 AM |
#Pay2Win
I wouldn't suggest using something so unfair as a game pass, but either way...
Set the Humanoids MaxHealth to a certain value (e.g. 150) and then set the Humanoids Health value to the MaxHealth value (Humanoid.Health = Humanoid.MaxHealth)
Simples |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 09:59 AM |
I can understand what you mean, but at the end of the day. I need the tix/Robux for advertisements towards the game. Although I haven't put them all that expensive, anyone can buy them. Anyway, back on topic. The game has a leveling system which increases your HP every time, so I can't change the MaxHealth, only add to it. |
|
|
| Report Abuse |
|
|
stroudie
|
  |
| Joined: 28 Nov 2008 |
| Total Posts: 2556 |
|
|
| 01 Sep 2013 10:41 AM |
Then just use...
Humanoid.MaxHealth = Humanoid.MaxHealth + HPAdd Humanoid.Health = Humanoid.MaxHealth
Where HPAdd is the value that you wish to add. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 10:58 AM |
local gpid = 128338642 local health = 50 -- Amount to extend GPS = game:GetService("GamePassService")
game:GetService("Players").PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c) if GPS:PlayerHasPass(p, gpid) then print("Has GPID") c.Humanoid.MaxHealth = char.Humanoid.MaxHealth + Health end end)
That should do for you. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 11:19 AM |
Thanks Owen, kind of embarrassed though :| Although my mind has been a little frazzled recently. |
|
|
| Report Abuse |
|
|