Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to move a models children smooth?

Up to now no one has helped me with this because every time I try it it is dead jittery and buggy, PLEASE help me move a models children (acting as a door.) SMOOTHLY like when you have 2 models the left door and the right door they move the opposite directions here is what I have so far. :)

local Model = script.Parent.D1
local Model2 = script.Parent.D2

function Move()
    for Index,Part in pairs(Model:GetChildren()) do
        if Part:IsA("BasePart") then
                     for i=1,20 do 
	Part.CFrame = Part.CFrame*CFrame.new(0,0,0.5) 
wait()    
    end  
wait()
        end
 for Index,Part in pairs(Model2:GetChildren()) do
        if Part:IsA("BasePart") then
            for i=1,20 do 
	Part.CFrame = Part.CFrame*CFrame.new(0,0,-0.5) 
wait()    
    end  
end
end 
end 
end 

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


1 answer

You've almost got it! Where you see "wait", just add a number as a parameter. I suggest .1 or .01. The downside to the script below is that it's going to move "Model" first, then when it's finished, it'll move "Model2"

local Model = script.Parent.D1
local Model2 = script.Parent.D2

function Move()
    for Index,Part in pairs(Model:GetChildren()) do
        if Part:IsA("BasePart") then
                     for i=1,20 do 
    Part.CFrame = Part.CFrame*CFrame.new(0,0,0.5) 
    end  
wait(0.1)
        end
 for Index,Part in pairs(Model2:GetChildren()) do
        if Part:IsA("BasePart") then
            for i=1,20 do 
    Part.CFrame = Part.CFrame*CFrame.new(0,0,-0.5) 
    end  
wait(0.1)
end
end 
end 
end 

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

1 comment

0

How do I do it so I can move both?

This discussion is preserved as it was. New answers, comments, and votes are closed.