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

Beizer Curve Erroring (CFrame expected, got number). Fixes?

Asked by 3 years ago

Hello, I was having issues with my beizer curve where it will say "Argument #1 (CFrame expected, got number). I was wondering if there is any fixes I can do to make my beizer curve actually function.

I assume the issue is in the bottom and top of my script.

function lerp(a, b, c)
    return a + (b - a) * c
end

function Quad(p0, p1, p2, t)
    return (1 - t)^2 * p0 + 2 * (1 - t) * t * p1 + t^2 * p2
end

function BarrageInfo.Effect(Character, Stand, Barrage)  
    BarrageInfo.State = true
    while BarrageInfo.State == true do
        local EndPosition = Stand.HumanoidRootPart.CFrame * CFrame.new(0, 0.5, -6)
        local StandLeft = Stand:FindFirstChild("Left Arm"):Clone()
        local LeftCFrame = CFrame.new((Stand.HumanoidRootPart.CFrame * CFrame.new(math.random(-2, -1.5), math.random(-2, 2), 0)).p, EndPosition.p) * CFrame.Angles(math.rad(90), 0, 0)
        local RightCFrame = CFrame.new((Stand.HumanoidRootPart.CFrame * CFrame.new(math.random(1.5, 2), math.random(-2, 2), 0)).p, EndPosition.p) * CFrame.Angles(math.rad(90), 0, 0)
        StandLeft.CanCollide = false
        StandLeft.Anchored = true
        StandLeft.Parent = Barrage
        StandLeft.CFrame = LeftCFrame
        Debris:AddItem(StandLeft, 0.25)
        local StandRight = Stand:FindFirstChild("Right Arm"):Clone()
        StandRight.CanCollide = false
        StandRight.Anchored = true
        StandRight.Parent = Barrage
        StandRight.CFrame = RightCFrame
        Debris:AddItem(StandRight, 0.25)
        local StandRightMiddle = StandRight.CFrame * CFrame.new(0.45, -0.75, 0.1)
        local StandRightEnd = StandRight.CFrame * CFrame.new(-0.45, -3, 0)
        for i = 1, 100 do
            local T = i
            local NewPosition = Quad(RightCFrame, StandRightMiddle, StandRightEnd, i/100)
            StandRight.CFrame = NewPosition
            wait(0.01)
        end
    end
end

Answer this question