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

How do I make my reload script preform this?

Asked by 10 years ago

So I have this reload script:

function reload(mouse)

    reloading=true
    sp.Handle.Reload:Play()
    mouse.Icon=ReloadCursor
    while sp.Ammo.Value<ClipSize and reloading and enabled do
        wait(ReloadTime/ClipSize)
        if reloading then
            sp.Ammo.Value=sp.Ammo.Value+1
            check()
        else
            break
        end
    end
    check()
    mouse.Icon=Cursors[1]
    reloading=false
end

function onKeyDown(key,mouse)
    key=key:lower()
    if key=="r" and not reloading then
        reload(mouse)
    end
end

I have this but it only makes it make the sound not reload:

sp.Ammo.Changed:connect(function()
        if sp.Ammo.Value == 0 or sp.Ammo.Value < 0 then
            mouse = game.Players.LocalPlayer:GetMouse()
            reload(mouse)
        end
    end)

This is basically the script that makes you reload and also the script that adds the ammo when you reload. This script is great and all but I am trying to make it reload automatically instead of having you click R because its annoying to do and also some people don't know how. If you can help me with this please let me know what I have to do? THANKS! -TixyScripter-

1 answer

Log in to vote
0
Answered by 10 years ago

At the end of the script, maybe add:

sp.Ammo.Changed:connect(function()
    if sp.Ammo.Value == 0 or sp.Ammo.Value < 0 then
        --mouse = game.Players.LocalPlayer:GetMouse()
        reload(mouse)
    end
end)

?? Don't know, never manipulated guns.

0
KillerKill29 it does play the noise but it does not reload the ammo. TixyScripter 115 — 10y
0
Does it change the cursor? killerkill29 35 — 10y
0
No it does not! TixyScripter 115 — 10y
0
try this, i edited the script killerkill29 35 — 10y
View all comments (2 more)
0
Try what? TixyScripter 115 — 10y
0
removed the mouse calling at line 3 killerkill29 35 — 10y
Ad

Answer this question