fireclickdetector Synchronous
Submit a ClickDetector interaction for the local player. Choose the default left click or one of the supported right-click and hover events.
Luau
fireclickdetector(detector: ClickDetector, distance: number?, event: string?) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
detector | ClickDetector | ClickDetector to activate. |
distance | number? | Optional simulated distance; omitted uses an unlimited-distance sentinel. |
event | string? | Optional event name: MouseClick, RightMouseClick, MouseHoverEnter, or MouseHoverLeave. Defaults to MouseClick. |
Returns
()No values.
Usage notes
A LocalPlayer must be available. An invalid event string raises an error. The detector’s MaxActivationDistance can affect hover behavior.
Example
Luau
local part = Instance.new("Part")
part.Parent = workspace
local detector = Instance.new("ClickDetector")
detector.Parent = part
local ok, reason = pcall(fireclickdetector, detector)
if not ok then print("Click unavailable:", reason) end
part:Destroy()