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

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

Asked by 4 years ago

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)
0
as alvinblox once said, put it in the start of your script- wait.. u would need a debounce greatneil80 2647 — 4y
1
Why are you using KeyDown in 2020 zboi082007 270 — 4y
2
OMG BEST OUTDATED SCRIPT ABOVE!! SO COOL XXDD Ziffixture 6913 — 4y
0
@Feahren lol CaIcuIati0n 246 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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.

0
nah, remove that keyboard part Gameplayer365247v2 1055 — 4y
Ad

Answer this question