would i have to use userinputservice two times, or is debounces needed?
this is not a request
would i have to use userinputservice two times, or is debounces needed?
this is not a request
Using UserInputService and Tick, I came up with this script. Change waitTime to the amount of time they have to press the button again.
local player=game.Players.LocalPlayer
local pressed=tick()
local waitTime=.3
local uis=game:GetService("UserInputService")
uis.InputBegan:connect(function(key)
if key.KeyCode==Enum.KeyCode.W then
if tick()-pressed<waitTime then
print("Pressed W twice")
else
print("Pressed W once")
end
pressed=tick()
end
end)
this is exactly what i was looking for, thank you very much
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Just a simple counter is needed with a set delay for its reset. You could also use a table to store the key pressed ect