What am I missing? clickdetector not running

local Radio = script.Parent
local ClickDetectorRadio = script.Parent.Part.ClickDetector
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Songs = {ReplicatedStorage.Assets.ChillJazz}
local RadioEnabled = false


local function RadioToggle()
	print("a")
	if not RadioEnabled then
		RadioEnabled = true
		print("playing")
		local Song = Songs[1]:Clone()
		Song.Parent = Radio ; Song:Play()
		return
	end
	
	RadioEnabled = false;
	local IsSong = Radio:FindFirstChildWhichIsA("Sound");
	if IsSong then IsSong:Destroy() end;
	
end

print("a1")
ClickDetectorRadio.MouseClick:Connect(RadioToggle)

the last print “a1” is printing so the script is running but the fgunction isnt being fired

image

i put it into a new place and its runs but its not running in the place am working on?

local Radio = script.Parent
local ClickDetectorRadio = script.Parent:WaitForChild("Part"):WaitForChild("ClickDetector")
1 Like

Still no and no errors or infinite yields

i copied the script into a different studio place and it worked but its not working in the one am working on

Send the file, I’ll have look.

1 Like

Sorry i cant because it has alot of work on it but i mightve found the issue


this bindaction in a random seperate script is killing the clickdetector
clickdetector works if nothings binded to left mouse button
Is this normal?

1 Like

What that script does, is it binds an action to left mouse button. This may be interfering with the clickdetector, because you unbind the clickdetector

2 Likes

If you were to bind an action to ‘w’, you could not use w to walk

1 Like

try

local ClickDetectorRadio = script.Parent:WaitForChild("Part"):WaitForChild("ClickDetector")

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.