Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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.

0
Are there any errors? Tkdriverx 514 — 8y
0
Nope CarterTheHippo 120 — 8y
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. Tkdriverx 514 — 8y
0
Wait! I see the problem. You aren't connecting the click detector to the function. You're connecting a RemoteEvent. Tkdriverx 514 — 8y

1 answer

Log in to vote
0
Answered by
Tkdriverx 514 Moderation Voter
8 years ago

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

clic.MouseClick:connect(onClicked)

0
ill test it, Sorry i was watching a football game CarterTheHippo 120 — 8y
0
This works, when filtering enabled is disabled. Which isn't what I am wanting. CarterTheHippo 120 — 8y
0
Roblox states that you need to connect it to a remote event when filtering enabled is active CarterTheHippo 120 — 8y
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. Tkdriverx 514 — 8y
Ad

Answer this question