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

How would I add a deboucne to this chargeable attack?

Asked by 7 years ago

I tried adding a debounce "k" but the script still doesn't work help?

wait(.1)
p = game.Players.LocalPlayer
c = p.Character
RS = c.Torso["Right Shoulder"]
hold = false
mouse = p:GetMouse()
local size = 2
k = false

function charge(key)
    key:lower()
    if key == "e" then
        if k == false then
        k = true
        hold = true
        for i = 1,20 do
        RS.C0 = RS.C0 *CFrame.Angles(0,0,-.16)
        end
        h = Instance.new("Part")
        h.BrickColor = BrickColor.new("Pearl")
        h.TopSurface = "Smooth"
        h.BottomSurface = "Smooth"
        h.CanCollide = false
        h.Shape = "Ball"
        h.Parent = game.Workspace
        while hold == true do
        wait()
        h.Size = Vector3.new(size,size,size)
        size = size+.05
        h.CFrame = c.Head.CFrame*CFrame.new(1.5,2,0)
        h.Anchored = true
    end
    end
end
end
function release(key)
    key:lower()
    if key == "e" then
        hold = false
        h:Destroy()
        for i = 1,20 do
        RS.C0 = RS.C0 *CFrame.Angles(0,0,.16)
        end
        hs = Instance.new("Part",game.Workspace)
        hs.Size = Vector3.new(size,size,size)
        hs.TopSurface = "Smooth"
        hs.BottomSurface = "Smooth"
        hs.Shape = "Ball"
        hs.Name = "Kiblastthe"
        hs.BrickColor = BrickColor.new("Pearl")
        y2 = Instance.new("BodyVelocity",hs)
        y2.maxForce = Vector3.new(math.huge,math.huge,math.huge)
        y2.velocity = c.Head.CFrame.lookVector*52
        hs.CFrame = c.Head.CFrame*CFrame.new(2,0,-6)
        wait(.75)
        for i = 1,10 do
            wait()
            hs.Transparency = hs.Transparency +.1
        end
        wait(.25)
        hs:Destroy()
        size = 2
        wait(.5)
        k = false
    end
end

mouse.KeyDown:connect(charge)
mouse.KeyUp:connect(release)

Answer this question