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
Are there any errors?
Nope
Instead of doing .fromEulerAnglesXYZ, you can do .Angles instead to do exactly the same thing. This isn't the problem, but just a suggestion.
Wait! I see the problem. You aren't connecting the click detector to the function. You're connecting a RemoteEvent.