generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Gamepass Extra HP Giver

Previous Thread :: Next Thread 
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
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
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
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 is not online. 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
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
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 is not online. 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
owenrules12 is not online. owenrules12
Joined: 26 Mar 2009
Total Posts: 402
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
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
01 Sep 2013 11:19 AM
Thanks Owen, kind of embarrassed though :|
Although my mind has been a little frazzled recently.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image