RS.RenderStepped:Connect(function()
	if KeyHeld == true then
		if sec < 10 then
			sec = sec + 1
			print(sec)
			wait(0.5)
		end
	else
		sec = 0
	end
end)

basiaclly I'm trying to make some kind of held down key triggers where it checks for how long it being held down in 0.5 seconds, but for some reason wait(0.5) doesn't works in here and it just adds 1 to sec immediately without waiting

4 comments

0

wait() does not work like that

0

explain please

0

cause I need to fix it

0

suakihiro renderstepped fires 60 times a second aka every 0.0166 s it fires, meaning ur above function will be called 60 timse a second, ur wait does literally nothing it doesnt yield the next renderstepped that is called