Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Humanoid MaxHealth Problem doesnt work?

Asked by 3 years ago

So im making combat game and i have 2 intValues in my powerfolder named Strength and Defense.i adjusted strength of punch with Strenght.Value but im having problem with changing maxhealth,before i found nice example but it only changed maxhealth at start it went something like this

if humanoid then humanoid.maxhealth = humanoid.maxhealth + (defense.value / 10) humanoid.health = humanoid.maxhealth end

but it doesnt work it kinda makes me invincible but what i want is when i do situp it changes maxhealth but so that it doesnt change health?

this is all locals i have in script

local Tool = script.Parent

local Player = Tool.Parent.Parent
local Character = Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Strength = Player.PowerFolder.Strength
local Defense = Player.PowerFolder.Defense

any help appreciated

Answer this question