local Humanoid = script.Parent:FindFirstChild("Humanoid")
local maxHealth = Humanoid.maxHealth
local character = script.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local Attributes = player:WaitForChild("Attributes")
local Strength = Attributes:WaitForChild("Strength")
local Durability = Attributes:WaitForChild("Durability")
local StrengthPerc = Strength.Value + (Strength.Value * 0.00575)
local DuraPerc = Durability.Value + (Durability.Value * 0.00575)
local scale
local scalePerc
-- Calculation of percentage changes
if Strength.Value + Durability.Value == 4 then scalePerc = 1
elseif Strength.Value + Durability.Value >= 4 then scalePerc = StrengthPerc + DuraPerc
elseif Strength.Value + Durability.Value <= 4 then scalePerc = .90
end
-- Function to update the max health and scale values based on the durability Attribute value
local function updateStats()
scale = 1
maxHealth = Humanoid.maxHealth + Durability.Value * 1
Humanoid.MaxHealth = maxHealth
Humanoid.Health = Humanoid.MaxHealth
Humanoid.BodyDepthScale.Value = (Humanoid.BodyDepthScale.Value * scalePerc)
Humanoid.BodyHeightScale.Value = (Humanoid.BodyHeightScale.Value * scalePerc)
Humanoid.BodyProportionScale.Value = (Humanoid.BodyProportionScale.Value * scalePerc)
Humanoid.BodyTypeScale.Value = (Humanoid.BodyTypeScale.Value * scalePerc)
Humanoid.BodyWidthScale.Value = (Humanoid.BodyWidthScale.Value * scalePerc)
Humanoid.HeadScale.Value = (Humanoid.HeadScale.Value * scalePerc)
print(scalePerc)
end
-- Update the stats when the durability Attribute value changes
Strength.Changed:Connect(updateStats)
Durability.Changed:Connect(updateStats)
wait(3)
Strength.Value = 7
Durability.Value = 7```
#Line running when it shouldn't
2 messages · Page 1 of 1 (latest)