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

Expected identifier when parsing expression, got '.' On line 17? please tell me what i did wrong

Asked by 2 years ago
Edited 2 years ago
local combo = 0
local tool = script.Parent
local player = tool.Parent.Parent
local Char = player.Character or player.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
local debounce = false  
local timeBetweenAttacks = 1
local timeAfterFinishedCombo = 2
local 

tool.Activated:Connect(function()
    if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
        return
    end
    if debounce then
        return
    end
    debounce = true
    combo += 1

    local timeBetweenAttacks = 1
    local timeAfterFinishedCombo = 2
    local eyes = Char.HumanoidRootPart.CFrame.LookVector
    local distance = 5

    local raycastpara = RaycastParams.new()
    raycastpara.FilterDescendantsInstances = {Char}
    raycastpara.FilterType = Enum.RaycastFilterType.Blacklist

    local hitPart = workspace:Raycast((Char.HumanoidRootPart.CFrame).p, eyes * distance, raycastpara)

    local function speed()
        hitPart.Instance.Parent:FindFirstChild("Humanoid").WalkSpeed = 0
        hitPart.Instance.Parent:FindFirstChild("Humanoid").JumpPower = 0
    end

    local function hitbox()
        if hitPart then
            if hitPart.Instance and hitPart.Instance.Parent:FindFirstChild("Humanoid") then
                if combo >= 4 then
                    local BV = Instance.new("BodyVelocity", hitPart.Instance.Parent:FindFirstChild("Humanoid"))
                    BV.MaxForce = Vector3(math.huge,math.huge,math.huge)
                    BV.Velocity = Char.HumanoidRootPart.LookVector * 25
                    hitPart.Instance.Parent.Humanoid:TakeDamage(5)
                    if combo == 4 then
                        hitPart.Instance.Parent.Humanoid:TakeDamage(10)
                        game.Debris:AddItem(BV,1)
                        speed()
                    end
                end
            end
        end
    end
    if combo == 1 then
        --Hit1:Play()
        hitbox()
        wait(timeBetweenAttacks)
    end

    if combo == 2 then
        --  Hit2:Play()
        hitbox()
        wait(timeBetweenAttacks)
    end

    if combo == 3 then
        --  Hit3:Play()
        hitbox()
        wait(timeBetweenAttacks)
    end

    if combo == 4 then
        --      Hit5:Play()
        hitbox()
        wait(timeAfterFinishedCombo)
        combo = 0
    end 

    debounce = false
end)

while true do
    wait()
    print(combo)
    print(debounce)
end

1 answer

Log in to vote
1
Answered by 2 years ago

Looking at your code a little closer, I noticed where you opened a variable and never closed it, maybe this is why its giving you an error? Here is the location of the error:

local -- HERE
tool.Activated:Connect(function()
    if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
        return

Hope this helps, I wish you the best.

1
Holy THANK YOU SO MUCH BRO IM SO DUMB LMAO thecoolguy436 38 — 2y
0
Its all good, we all make mistakes sometimes lol CameUpFromNothing 37 — 2y
Ad

Answer this question