Increasing Humanoid Health Gain Speed

Hi, Im trying to make a Health gain speed gamepass heres the script

local MarketPlaceService = game:GetService(“MarketplaceService”)

local GamepassId = 14985258

local Players = game:GetService(“Players”)
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
while true do wait(1)
Character:WaitForChild(“Humanoid”).Health = Player.Humanoid.Health + 5
end
end
end)
end)

but when i try i get this error
image

what is the best way to do this

Please help!

1 Like

Can you make this in script formant? I find it easier to comprehend if you do. What I mean is make the text Like this but with code

1 Like

How do i do that :sweat_smile: im not sure how to format a script

1 Like
local MarketPlaceService = game:GetService("MarketplaceService")

local GamepassId = 14985258

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
			while true do wait(1)
				Character:WaitForChild("Humanoid").Health = Player.Humanoid.Health + 5
			end
		end
	end)
end)

Lol thanks. Now let me take a closer look.

1 Like

Just so you know…

Put it between two ```.

(here)this is my script(here)

Replace ‘(here)’ with ```.

Result:
this is my script

2 Likes

So I fixed it.

local MarketPlaceService = game:GetService("MarketplaceService")

local GamepassId = 5735397

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
			while true do wait(1)
				local Humanoid = Character:WaitForChild("Humanoid")
				if Humanoid ~= nil then
					Humanoid.MaxHealth = Humanoid.MaxHealth + 5
					Humanoid.Health = Humanoid.Health + 5
				end
				
			end
		end
	end)
end)

In this it changes their health every few seconds, if you just want it to be +5, then remove the loop. I was wondering what was wrong then I realized that the MaxHealth was just 100 and wasn’t changing.

1 Like

Thank you so much for Helping :smiley:

1 Like

Anytime. I hope your game does well!

wait Quick Question when i take damage from my player it fully heals him instead of +5 every second

I think that is likely because of the regen rate. If your health is 1000, you are going to heal 10 health every second up until you reach your max. Or 500, 5 health until you reach full health. So it heals faster than you can do damage.

anyway, like lets say if i take take i always get 10 heath every 5 seconds :smiley:

Because the system is a bit broken if you think about it

¯\ _(ツ)_/¯.

I guess you’d have to modify health regen. There is a health script in the player. So you could delete that and clone your makeshift Health Script and put it in the Character. But depending on what you want for the gamepass you could just remove the loop to make it so that they just get 5+ health.

Dang, i wanted to try regen health speed :confused: