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

How to I keep it from Reloading? [closed]

Asked by 10 years ago
function Reload()
    if Cooldown==true then return end
    if (GoalPercent~=0) and (TargetCFrame~=GunHolds["Camera_Zoom"][2]) then return end
    Cooldown=true   
    TargetCFrame=GunHolds["Camera_Reload"][2]
    GoalPercent=1
    ggoaly=math.rad(-15)
    wait(0.25)
    for i = 0,0.9,0.09 do
        TransitionWeld(LArmCFs["L_Arm"][2],LArmCFs["L_RP_Trans"][2],armW,i)
        TransitionWeld(GArmCFs["L_Arm"][2],GArmCFs["L_RP_Trans"][2],garmW,i)
        wait()
    end
    ggun.c1.Transparency=1
    gun.c1.Transparency=1
    Sounds["Reload"]:play()
    for i = 0,0.9,0.09 do
        TransitionWeld(GArmCFs["L_RP_Trans"][2],GArmCFs["L_RP_1"][2],garmW,i)
        TransitionWeld(LArmCFs["L_RP_Trans"][2],LArmCFs["L_RP_1"][2],armW,i)
        wait()
    end
    wait(0.25)
    for i = 0,0.9,0.1 do
        TransitionWeld(GArmCFs["L_RP_1"][2],GArmCFs["L_RP_2"][2],garmW,i)
        TransitionWeld(LArmCFs["L_RP_1"][2],LArmCFs["L_RP_2"][2],armW,i)
        wait()
    end
    gun.c1.Transparency=0
    ggun.c1.Transparency=0
    needs=(script.PerClip.Value-script.InClip.Value)
    script.TotalAmmo.Value=script.TotalAmmo.Value-needs
    script.InClip.Value=script.InClip.Value+needs
    wait(0.05)
    for i = 0,1,0.15 do
        TransitionWeld(GArmCFs["L_RP_2"][2],GArmCFs["L_RP_3"][2],garmW,i)
        TransitionWeld(LArmCFs["L_RP_2"][2],LArmCFs["L_RP_3"][2],armW,i)
        wait()
    end
    wait(0.25)
    for i = 0,1,0.25 do
        TransitionWeld(OtherParts["Reload1"][2],OtherParts["Reload2"][2],OtherParts["Reloader"][3],i)
        TransitionWeld(GArmCFs["L_RP_3"][2],GArmCFs["L_RP_4"][2],garmW,i)
        TransitionWeld(LArmCFs["L_RP_3"][2],LArmCFs["L_RP_4"][2],armW,i)
        wait()
    end
    for i = 0,1,0.25 do
        TransitionWeld(OtherParts["Reload2"][2],OtherParts["Reload1"][2],OtherParts["Reloader"][3],i)
        TransitionWeld(GArmCFs["L_RP_4"][2],GArmCFs["L_RP_3"][2],garmW,i)
        TransitionWeld(LArmCFs["L_RP_4"][2],LArmCFs["L_RP_3"][2],armW,i)
        wait()
    end
    wait(0.25)
    for i = 0,1,0.05 do
        TransitionWeld(GArmCFs["L_RP_3"][2],GArmCFs["L_Arm"][2],garmW,i)
        TransitionWeld(LArmCFs["L_RP_3"][2],LArmCFs["L_Arm"][2],armW,i)
        wait()
    end
    wait(0.1)
    ggoaly=0
    GoalPercent=0
    Cooldown=false
end

This reloads and makes the TotalAmmo in my guns go negative numbers instead of staying at 0 how do I fix that?

0
Around line 30, check how much ammo is left before you do the math. GoldenPhysics 474 — 10y

Closed as Too Broad by OniiCh_n, Lacryma, and BlueTaslem

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Why was this question closed?