So i’m trying to make something appear after holding down a key for a certain amount of time but I don’t know how to go about it. Can some explain how i should go about doing this, please and thank you
Try this! This gives you information on how to make a KeyDown happen - and I think you can just add a delay of say 3 seconds then it will be what you want. I may be wrong, but I know this is how a KeyDown is made.
https://developer.roblox.com/en-us/api-reference/event/Mouse/KeyDown
KeyDown is deprecated now.
Use UserInputService instead.
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.E and not processed then
-- // is E, change E to your target key. You can find keycodes on the RBLX wiki
end)
EDIT: My bad, read it wrong.
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, processed)
if UserInputService:IsKeyDown(Enum.KeyCode.E) and not processed then
--// Do something
end
end)
Untested, but should work.
Sorry if I mislead you but i understand keydown and userinputservice. What I meant was, say you hold down the key p and after 1 seconds passes something pops up and then after 2 seconds another thing pops and etc.
My bad, updated original post. I read it wrong, but that should give you the answer.
You can find more information on this here:
https://developer.roblox.com/en-us/api-reference/function/UserInputService/IsKeyDown