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

Door not working properly for models, am I doing something wrong?

Asked by 4 years ago

So I have a good working script for a union or a part, but for some reason it doesnt work for models what am I doing wrong?

d = false function onClicked() if d == false then d = true

    for i = 1,49 do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, 0.244) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
    wait()
    end
    wait(4)
    for i = 1,49 do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, -0.244) * CFrame.fromEulerAnglesXYZ(0, 0, 0) 
    wait()
    end
    d = false
end

end script.Parent.ClickDetector.MouseClick:connect(onClicked)

0
That's because Models don't have a `CFrame`, they're just a container to hold objects, they don't have any real functionality. You can only move models using `SetPrimaryPartCFrame` and use a PrimaryPart on your model. User#834 0 — 4y
0
Ok! I'll try that! thanks LimitedVxrsion 3 — 4y

Answer this question