I tried changing the max click distance, but that didnt work for some reason. Can someone please help? Like in ROBLOX Studio how you can add a click detector to a part, how do I make it so if an event were to trigger, it would trigger a script to add a click detector to a certain part. For example, I'm trying to make a small horror game, there is a power switch, that you cant click, but then the lights go off, which then adds a ClickDetector to the power switch which lets me click the Power Switch
✓ ANSWER ACCEPTED
How do I add a click detector to a certain part using a script?
1 answer
✓ Accepted answer
So you would need to do this
local function create_detector()
local click_detector = Instance.new("ClickDetector")
--//Code
end
create_detector()
If you wanted it to fire when a RemoteEvent is fired, you can do this:
local remote_event = --//Path to remote event
remote_event.OnServerEvent:Connect(function()
local click_detector = Instance.new("ClickDetector")
--//Code
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Please explain more. We can't help you with the information provided.
@Soban06 is right, please provide more information as we cannot help you.
Like in ROBLOX Studio how you can add a click detector to a part, how do I make it so if an event were to trigger, it would trigger a script to add a click detector to a certain part. For example, I'm trying to make a small horror game, there is a power switch, that you cant click, but then the lights go off, which then adds a ClickDetector to the power switch which lets me click the Power Switch.