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

I cannot change MaxActivationDistance on a click detector?

Asked by
ExcelUp 24
6 years ago

In my script I have it so that four different parts move up, wait three seconds, then move down. These four parts consist of two 'parts' and two 'unions'. The CFrame works completely fine, but I cannot change the MaxActiviationDistance on my click detector, as I get the following error.

'MaxActivationDistance is not a valid member of UnionOperation.'

How can I solve this?

Code:

button = script.Parent
doorModel = game.Workspace.main_door
door = doorModel.door
door1 = doorModel.door_part_1
door2 = doorModel.door_part_2
door3 = doorModel.door_part_3

moved = 0

button.ClickDetector.MouseClick:connect(function()
    button.MaxActivationDistance = 0
    while moved < 90 do
        door.CFrame = door.CFrame + Vector3.new(0,0.1,0)
        door1.CFrame = door1.CFrame + Vector3.new(0,0.1,0)
        door2.CFrame = door2.CFrame + Vector3.new(0,0.1,0)
        door3.CFrame = door3.CFrame + Vector3.new(0,0.1,0)
        moved = moved + 1
        wait(.01)
    end
    moved = 0
    wait(3)
    while moved < 90 do
        door.CFrame = door.CFrame + Vector3.new(0,-0.1,0)
        door1.CFrame = door1.CFrame + Vector3.new(0,-0.1,0)
        door2.CFrame = door2.CFrame + Vector3.new(0,-0.1,0)
        door3.CFrame = door3.CFrame + Vector3.new(0,-0.1,0)
        moved = moved + 1
        wait(.01)
    button.MaxActivationDistance = 5
    end
end)
0
Nevermind, just found the error. I didn't type 'button.ClickDetector'. ExcelUp 24 — 6y

Answer this question