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

How would I go about moving a model smoothly?

I'm trying to make it so the two sides of the doors slide to the left and right, whilst the statue goes down but at the moment, the doors slide but the statue vanishes and doesn't come back.. Any ideas on how to fix?

debounce = false

script.Parent.Touched:connect(function(hit)
if debounce  == true then return end
debounce = true
if hit.Name == "Alohomora" then
  for i = 1,40 do
    game.Workspace.Door1.DoorA.CFrame = game.Workspace.Door1.DoorA.CFrame + Vector3.new(.50,0,0)
    game.Workspace.Door1.DoorB.CFrame = game.Workspace.Door1.DoorB.CFrame + Vector3.new(-.50,0,0)
    game.Workspace.Door1.Statue:MoveTo(Vector3.new(game.Workspace.Door1.Statue.MagicPoint.Position.X,game.Workspace.Door1.Statue.MagicPoint.Position.Y -.5,game.Workspace.Door1.Statue.MagicPoint.Position.Z))
    wait()
  end

  wait(5)
  for i = 1,40 do
    game.Workspace.Door1.DoorA.CFrame = game.Workspace.Door1.DoorA.CFrame + Vector3.new(-.50,0,0)
    game.Workspace.Door1.DoorB.CFrame = game.Workspace.Door1.DoorB.CFrame + Vector3.new(.50,0,0)
    game.Workspace.Door1.Statue:MoveTo(Vector3.new(game.Workspace.Door1.Statue.MagicPoint.Position.X,game.Workspace.Door1.Statue.MagicPoint.Position.Y +.5,game.Workspace.Door1.Statue.MagicPoint.Position.Z))
    wait()
  end
else
end
debounce = false
end)

Thank you.

6 comments

0

Tweening

0

lerp too boi

0

Put a humanoid in literally everything and use the MoveTo function, I highly recommend this (sarcasm)

0

That is incredibly stupid.

0

reposition each part individually in a while loop

0

You cant move a model lmao ????. Make a primary part for that model and instead move the primary part CFrame and it sort of "welds" and holds the entire model (The PrimaryPart)

1 answer

Found a solution by using SetPrimaryPartCFrame. After that I had to use CFrame.Angles(0, math.pi / 2, 0)) because the statue ended up facing the wrong way.

debounce = false

script.Parent.Touched:connect(function(hit)
if debounce  == true then return end
debounce = true
if hit.Name == "Alohomora" then
   for i = 1,40 do
	game.Workspace.Door1.Statue:SetPrimaryPartCFrame(CFrame.new(game.Workspace.Door1.Statue.MagicPoint.Position.X,game.Workspace.Door1.Statue.MagicPoint.Position.Y-1,game.Workspace.Door1.Statue.MagicPoint.Position.Z)* CFrame.Angles(0, math.pi / 2, 0))
     wait()
     end
wait(1)

for i = 1,40 do
   game.Workspace.Door1.DoorA.CFrame = game.Workspace.Door1.DoorA.CFrame + Vector3.new(.50,0,0)
	game.Workspace.Door1.DoorB.CFrame = game.Workspace.Door1.DoorB.CFrame + Vector3.new(-.50,0,0)
	wait()
	end

wait(5)
for i = 1,40 do 
	game.Workspace.Door1.DoorA.CFrame = game.Workspace.Door1.DoorA.CFrame + Vector3.new(-.50,0,0)
	game.Workspace.Door1.DoorB.CFrame = game.Workspace.Door1.DoorB.CFrame + Vector3.new(.50,0,0)
	
	wait()
end

for i = 1,40 do
   game.Workspace.Door1.Statue:SetPrimaryPartCFrame(CFrame.new(game.Workspace.Door1.Statue.MagicPoint.Position.X,game.Workspace.Door1.Statue.MagicPoint.Position.Y+1,game.Workspace.Door1.Statue.MagicPoint.Position.Z)* CFrame.Angles(0, math.pi / 2, 0))
	wait()
	end
else 
end
debounce = false
end)

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