How could I detect if a player is activating a proximity prompt without using the proximity prompt
use the function ProximityPrompt.Triggered
The player is activating a proximity prompt but their not using it? I don’t understand. Are you referring to when a player presses a key on their keyboard?
1 Like
Yeah, I cant seem to find any functions that do that
You have to use a local script:
-- We must get the UserInputService before we can use it
local UserInputService = game:GetService("UserInputService")
-- A sample function providing one usage of InputBegan
local function onInputBegan(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.E then -- detects E key
print("e pressed")
end
end
UserInputService.InputBegan:Connect(onInputBegan)
would that detect everytime player presses E?
No because you would put it in a place were it can be seen locally, starter gui, starterplayer scripts, ect
1 Like
Don’t use this, it’s arbitrary and will fire irrespective of whether or not a ‘ProximityPrompt’ instance is currently being triggered.
The correct signal to use is PromptButtonHoldBegan
.
https://developer.roblox.com/en-us/api-reference/event/ProximityPrompt/PromptButtonHoldBegan
1 Like