
Mastering Roblox Coding
By :

The previous sections taught us many different ways to listen to user input. We started by looking into ClickDetectors, ProximityPrompts, and tools. All of these had their own use cases. After that, we looked at keyboard, gamepad, and mouse input using the UserInputService
. Finally, we also learned about the ContextActionService
, which was similar to the functions we have seen on the UserInputService
. So, what do we use, and when?
First, we will take a look at ClickDetectors and ProximityPrompts. Both are very similar. ClickDetectors work when a player clicks on the BasePart that the ClickDetector is in. The ProximityPrompt shows a GUI when the player is near the BasePart that the ProximityPrompt is in. Unlike the ClickDetector, ProximityPrompts work based on key input, whereas ClickDetectors work on a left mouse click or something similar for consoles and phones. So, when choosing between ClickDetectors and ProximityPrompts, base it on whether...