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

What is wrong with my Reload Script?

So it all works, changes the Gui etc, but it doesn't do it smoothly. It just skips straight to 12, rather than waiting and changing it by 1 every 0.1 of a second. What is wrong with my code?

		mouse.KeyDown:connect(function(key)
			local key = string.lower(key)
			if key == "r" then
				if ammo < 12 then
					repeat
						ammo = ammo + 1
						clone.Ammo.Text = ammo.."/12"
						wait(0.1)
					until
						ammo == 12
				end --end if ammo < 12
			end --end if key == "r"
		end) --end keydown function

1 answer

I can't think of why it might be skipping the rest, but try this code:

mouse.KeyDown:connect(function(key)
	local key = string.lower(key)
	if key == "r" then
		while ammo < 12 then
			ammo = ammo + 1
			clone.Ammo.Text = ammo .. "/12"
			wait(0.1) -- One tenth of a second is a *very* short time.
		end
	end
end)

Maybe your problem is just that it reloads so fast, you simply can't see 1 through 11?

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