Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Click Detector Not Working Because of Filtering Enabled, How would you fix it?

This script is suppose to move this entire model, by only clicking on one part. However, it isn't working properly....

No output errors, Ive tried same script in local and regular.

The script has to work with Filtering Enabled

Here is the script:

wait(1)
script.Parent.PrimaryPart = script.Parent.Main
local Main = script.Parent:GetPrimaryPartCFrame()
local part = script.Parent.Main
local clic = part.ClickDetector
local sound = script.Parent.Sound
local Sensor = part 

function onClicked() 
	if script.Parent.Open.Value == 1 then 
	sound:Play()
	fix = script.Parent.Main.CFrame 
	for i = 0,1.5,0.1 do
		wait(0.05)
		script.Parent:SetPrimaryPartCFrame(script.Parent.Main.CFrame*CFrame.fromEulerAnglesXYZ(0,-0.1,0)*CFrame.new(0.01,0,-0.25))
		script.Parent.Open.Value = 0
		clic.MaxActivationDistance = 0
	end
		script.Parent:SetPrimaryPartCFrame(fix*CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0)*CFrame.new(-2.5,0,-2.5))
		wait(0.25)
		clic.MaxActivationDistance = 15
	elseif script.Parent.Open.Value == 0 then
		sound:Play()
		fix = script.Parent.Main.CFrame 
	for i = 0,1.5,0.1 do
		wait(0.05)
		script.Parent:SetPrimaryPartCFrame(script.Parent.Main.CFrame*CFrame.fromEulerAnglesXYZ(0,0.1,0)*CFrame.new(-0.01,0,0.25))
		clic.MaxActivationDistance = 0
	end
		script.Parent:SetPrimaryPartCFrame(fix*CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)*CFrame.new(-2.5,0,2.5))
		wait(0.25)
		clic.MaxActivationDistance = 15
		script.Parent.Open.Value = 1
	end
end

part.ClickEvent.OnClientEvent:connect(onClicked) 

If this is set up in a regular onclicked script it works, So im very confused.

I have tested this with and without filtering enabled activated. Doesn't work either way.

4 comments

0

Are there any errors?

0

Nope

0

Instead of doing .fromEulerAnglesXYZ, you can do .Angles instead to do exactly the same thing. This isn't the problem, but just a suggestion.

0

Wait! I see the problem. You aren't connecting the click detector to the function. You're connecting a RemoteEvent.

1 answer

You aren't connecting the click detector to the function. You're connecting a RemoteEvent.

clic.MouseClick:connect(onClicked)

4 comments

0

ill test it, Sorry i was watching a football game

0

This works, when filtering enabled is disabled. Which isn't what I am wanting.

0

Roblox states that you need to connect it to a remote event when filtering enabled is active

0

ClickDetectors should still work with FilteringEnabled. That remote event is only for client to server communication, not for ClickDetectors, they already bypass the filter and work just fine as normal.

This discussion is preserved as it was. New answers, comments, and votes are closed.