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

How to move a model's children, smoothly?

Asked by
Nidoxs 190
10 years ago

Here is the output and the script I made.

Output : 14:36:02.502 - Workspace.Model.Lever.Script:5: attempt to index field 'Position' (a nil value) 14:36:02.504 - Stack Begin 14:36:02.505 - Script 'Workspace.Model.Lever.Script', Line 5 14:36:02.506 - Stack End

local BS = script.Parent.Parent:GetChildren() 

function Move() 
    wait(2) 
    BS.Position.CFrame = BS.Position.CFrame*CFrame.new(0,1,0)
end 

script.Parent.ClickDetector.MouseClick:connect(Move)

1 answer

Log in to vote
0
Answered by
Vrakos 109
10 years ago
local Model = game.Workspace.Model

function Move()
    for Index,Part in pairs(Model:GetChildren()) do
        if Part:IsA("BasePart") then
            Part.CFrame = Part.CFrame + Vector3.new(0,1,0)
        end
    end
end

I believe this would work.

Ad

Answer this question