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.

Syntax
Luau
fireclickdetector(detector: ClickDetector, distance: number?, event: string?) -> ()

Parameters

Function parameters
ParameterTypeDescription
detectorClickDetectorClickDetector to activate.
distancenumber?Optional simulated distance; omitted uses an unlimited-distance sentinel.
eventstring?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

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()
Kawaii documentation