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

Take damage function doesnt work on unequip fix?

Asked by 3 years ago
Tool = script.Parent
    function onEquippedLocal()
            local humanoid = Tool.Parent:FindFirstChild("Humanoid")
    humanoid.MaxHealth = humanoid.MaxHealth + 25
    humanoid.Health = humanoid.health + 25
    end

    function onUnequippedLocal()
            local Player = Tool.Parent.Parent
            local Character = Player.Character or Player.CharacterAdded:Wait()
    local Humanoid = Character:WaitForChild("Humanoid")

    Humanoid.MaxHealth = 100
    Humanoid.TakeDamage = 25

        end

    -- Use 'Connect' as 'connect' is deprecated.
    Tool.Equipped:Connect(onEquippedLocal)
    Tool.Unequipped:Connect(onUnequippedLocal)

the humanoid doesnt take 25 dmg but the max health get set to be 100

Answer this question