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 5 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

01    for i = 1,49 do
02    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, 0.244) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
03    wait()
04    end
05    wait(4)
06    for i = 1,49 do
07    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, -0.244) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
08    wait()
09    end
10    d = false
11end

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 — 5y
0
Ok! I'll try that! thanks LimitedVxrsion 3 — 5y

Answer this question