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

2 comments
Use region3, then check the inventory for that button.
^