Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make my reload script preform this?

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

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.

6 comments

0

KillerKill29 it does play the noise but it does not reload the ammo.

0

Does it change the cursor?

0

No it does not!

0

try this, i edited the script

0

Try what?

0

removed the mouse calling at line 3

This discussion is preserved as it was. New answers, comments, and votes are closed.