ClickDetector Not Working Inside Roblox Studio?

  1. What do you want to achieve? I made a door that plays a sound and tweens once Clicked on by a ClickDetector.

  2. What is the issue? The problem that I had was the ClickDetector only detected a click in the actual games, not in Studio. There were no warnings, errors, etc about this and I wasn’t able to find anything on this topic.

  3. What solutions have you tried so far? I tried to use a new ClickDetector, only for it to not work. I tried re-scripting it and that also did not work. It seems the only thing that did work though is the HoverOver event.

print("1")
local Door_Open_Sound = script.Parent["Door Opening"]
print("2")

local Debounce = false

Detect.MouseClick:Connect(function()
	Debounce = true
	
	print("hELLO wORLDSOSS")

image (These were the prints I have gotten from the script, but I still didn’t get the “hELLO wORLDSOSS” print from clicking on the door)

local Click = script.Parent.ClickDetector
local Part = script.Parent

Click.MouseHoverEnter:Connect(function()
	print("Work")
end)

(HoverOver is the only ClickDetector event that does work inside Roblox Studio for me.)

2 Likes

Maybe try to put ClickDetector full name

Maybe for your first script try use the full name off clickDirtector

If it is a local script in workspace it won’t work. Localscript are disabled so make sure it is a Regular Script

It’s not a LocalScript before it wouldn’t work, like I said, the ClickDetector doesn’t work in Studio, only real servers.

What is the variable ‘Detect’ assigned to; if it is not assigned to the click detector, that could be your issue?

local part = script.Parent
local clickDetector = part.ClickDetector

local function foo()

print("Hello there - Obi Wan Kenobi")

end

clickDetector.MouseClick:Connect(foo)

Try this in studio and see if the issue still occurs.

Detect is the Variable for ClickDetector though

Could you provide more code and possibly the error in the output window please?

I said there was no error in the output, and the rest of the code is just sounds and tween.

Sorry, it just looks like there is a possible error message that has been cut off the image to me.

image

image More define Image

That red cut off you see is just part of my Menu-Script. When you press play, it deletes the camera Part, so the script creates a error because of it

1 Like