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

[OMG OMG BEST QUESTION HERE?!?!? -->] Where should i add a wait(5) in this script?

where should i add a wait before pressing q for this thing to run again?

mouse.KeyDown:Connect(function(key)
	if key == "q" then
			print("ITWORKED")
			wait(5)
		end
	end)

4 comments

0

as alvinblox once said, put it in the start of your script- wait.. u would need a debounce

1

Why are you using KeyDown in 2020

2

OMG BEST OUTDATED SCRIPT ABOVE!! SO COOL XXDD

0

@Feahren lol

1 answer

Use UserInputService

In a LocalScript ClientScript

local UserInputService = game:GetService('UserInputService')

local Debounce = true

UserInputService.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Q and Debounce then
		Debounce = false
		print("that's work.")
		wait(5)
		Debounce = true
	end
end)

Hope this help, to more questions put bellow on commentaries.

1 comment

0

nah, remove that keyboard part

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