wait(0.5)
print("Sledgehammer equipped")
script.Parent.Humanoid.Health = 75
script.Parent.Humanoid.MaxHealth = 75
--This will change the Health of the player when equipping this tool.
I don’t have good scripting knowledge so this is a very bad script. is there a way to do the effect mentioned in the title?
I would like to add to this. Because the above script will heal the player, if the player’s health is below the maxhealth.
local Players = game:GetService("Players")
local Player = script.Parent:FindFirstAncestorWhichIsA("Player")
local Humanoid = Player.Character:WaitForChild("Humanoid")
local EquipHealth = 75
local UnequipHealth = 100
local Tool = script.Parent
Tool.Equipped:Connect(function()
Humanoid.MaxHealth = EquipHealth
if Humanoid.Health > EquipHealth then
Humanoid.Health = EquipHealth
end
end)
Tool.Unequipped:Connect(function()
Humanoid.MaxHealth = UnequipHealth
end)