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

Board with a nail In It weapon not having Its lunge attack working (?)

Asked by 2 years ago

As the name says, I made a board with a nail In It weapon that has two attacks, a normal attack which makes the player slashes, that does 10 damage, and a lunge attack which can be activated when double clicking, this will do 20 damage and lunges the player while doing so, but It appears to not lunge the player

Script:

----God Dang It, Its just a modern remake of linked sword, just the lunge, well lunges you----
local tool = script.Parent
local CanDoubleClickBoolValue = tool.CanDoubleClick
local Timer = 0.10
local AmountOfDamage = 10 ---The Default damage of the tool
local Boolens = {
    Debounce = false,
    CanDamage = false
}
local Sounds = {
    Hit = tool.Hit,
    Woosh = tool.Woosh
}


tool.Activated:Connect(function()
    if not Boolens.Debounce then
        Boolens.Debounce = true
        Sounds.Woosh:Play()
        Boolens.CanDamage = true
        CanDoubleClickBoolValue.Value = true
        local Str = Instance.new("StringValue")
        Str.Name = "toolanim"
        Str.Value = "Slash"
        Str.Parent = tool
        wait(Timer)
        CanDoubleClickBoolValue.Value = false
    elseif Boolens.Debounce and CanDoubleClickBoolValue.Value then
        Sounds.Woosh:Play()
        tool.Parent.Humanoid.Jump = true
        AmountOfDamage = 20
        local Str = Instance.new("StringValue")
        Str.Name = "toolanim"
        Str.Value = "Slash"
        Str.Parent = tool
        local VectorForce = Instance.new("VectorForce")
        local Attachment = Instance.new("Attachment")

        VectorForce.Parent = tool.Parent.Torso
        Attachment.Parent = tool.Parent.Torso
        VectorForce.Force = Vector3.new(0,300,-6000)
        VectorForce.Attachment0 = Attachment
        VectorForce.ApplyAtCenterOfMass = true
        game:GetService("Debris"):AddItem(VectorForce,0.5)
        game:GetService("Debris"):AddItem(Attachment,0.5)
    end
    wait(2)
    AmountOfDamage = 10
    Boolens.CanDamage = false
    Boolens.Debounce = false
end)
---HEHEHE TWO TOOL.HANDLE.TOUCHED:CONNECT(FUNCTION(HIT) GO BRRRR---
tool.Handle.Touched:Connect(function(hit)
    local humanoid = hit.Parent:WaitForChild("Humanoid")
    if humanoid and Boolens.CanDamage == true then
        humanoid:TakeDamage(AmountOfDamage)
        Boolens.CanDamage = false
    end
end)
tool.Handle.Touched:Connect(function(hit)
    print("Ignore this, this Is used to detect players and damage them, however also doesn't damage teammates")
end)

Answer this question