Let me restate my predicament because I wasn’t really well rested yesterday so I think I might have said things that were unclear.
I have a game where players without a character are able to use free cam. However, in free cam mode, their client is able to trigger click detectors. I could, of course, iterate through each of these and set their MaxActivationDistance
to 0
but, in cases where another script changes the MaxActivationDistance
value, the value could get overridden.
I guess my real question was if there was a way to just disable all click detectors with the ContextActionService
because of this quote on the developer wiki:
If an action bound with /ContextActionService
uses the same input as a ClickDetector, the bound action will take priority and the ClickDetector events will not fire.
However, if this isn’t possible, I guess I’ll create a system where properties can be updated with a priority value. Something like:
Spectator script:
-- Upon entering spectator mode...
for _, click_detector in pairs(workspace:GetDescendants()) do
if click_detector:IsA("ClickDetector") then
InstancePropertyPriorityAPI:set_property_with_priority(
InstancePropertyPriorityAPI.Priority.HIGH,
click_detector, "MaxActivationDistance", 0)
end
end
Some other script:
-- When a click detector needs to be disabled for some in-game thingy...
InstancePropertyPriorityAPI:set_property_with_priority(
InstancePropertyPriorityAPI.Priority.LOW,
click_detector, "MaxActivationDistance", 0)
The reason I didn’t really want to do this is that my project for school is nearing due date and I wasn’t too keen on the idea of changing all of the instances of click detector usage (of which there are a lot) but I guess I could “bite the bullet” as a last case scenario. But again, in development, sometimes the best solution is to change everything.
Sorry for the troubles,
Rad