So basically i want to check if a player is in a specific place (i used onTouch) , and i want to see if the player holds a button in that area, but nothing happens with my code:
local sensor = script.Parent local function onTouch(sensor) KeyHeld = false function onKeyPress(inputObject,gameProcessed) if inputObject.KeyCode == Enum.KeyCode.V then KeyHeld = true while KeyHeld do -- code wait() end end end function onKeyRelease(inputObject,game.Processed) if inputObject.KeyCode == Enum.KeyCode.V then KeyHeld = false end game:GetService("UserInputService").InputBegan:connect(onKeyPress) game:GetService("UserInputService").InputEnded:connect(onKeyRelease) end