generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Moving a model

Previous Thread :: Next Thread 
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
27 Apr 2014 07:42 PM
I need to move a model. As far as I can tell, there are two ways to do this. One, make welds and just move one part. (Can't do this because there is a lot of parts and I don't know how to do welds)
2. Use the MoveTo() method. I tried this, look what happened:

Workspace.A.Value = (-56.5, 0.09, -69)
Tile1.Parts:MoveTo( Workspace.A.Value + Vector3.new(0, 37.4, 0))
It ended up at 130.9, 241.59, 61. Lol?

I can't just add them together because Workspace.A will be changing.
Any ideas?
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
27 Apr 2014 08:05 PM
Bump.
All the hierarchies are correct, by the way.
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
27 Apr 2014 08:11 PM
um wtf

Vector3.new is missing when you declare the workspace.A.Value
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
27 Apr 2014 08:17 PM
--Put in command bar, edit 'model' to name of your model and make the name different from every other model in the workspace, will create the welds for you.(Only direct children though)

model = "Put the name of the model here"
Model = game.Workdpace:FindFirstChild(model)
c = Model:GetChildren()
bseprt = (c[math.random(1,#c)])
bseprt.Name = "Move This Part"

for i = 1,#c do
w = Instance.new("Weld",c[i])
w.Part0 = w.Parent
w.Part1 = bseprt
end

Make every child of the model a direct child(Don't have models inside the model) and look for the part named 'Move This Part' inside the model, then move that part.
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
28 Apr 2014 08:09 PM
So. this is my script:

Model = script.Parent
c = Model:GetChildren()
bseprt = script.Parent.Parent.Baseplate

for i = 1,#c do
w = Instance.new("Weld",c[i])
w.Part0 = w.Parent
w.Part1 = bseprt
end

I get the error: "Bad cast"
?
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
28 Apr 2014 08:43 PM
Bermp
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
28 Apr 2014 08:46 PM
And looking at the wiki, what's all this stuff about C0 and C1?
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 04:01 PM
bump
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 05:39 PM
But there are lots of people that move models! People use welds all the time, right?
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 05:50 PM
Figured it out.

I had the script inside the model -it tried to weld the script.
I'll just add a part filter now...
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 06:26 PM
So the welds worked great!

So. I tried cframing part one... and the welds didn't work. The welds are all there, but the rest of the parts didn't come when I cframed..
Do I have to reset the position instead?
I'll try it..
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 06:33 PM
Hmmm.
Resetting the position doesn't work either.
What do welds do then? I thought they held parts together when they are moved.
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 07:17 PM
Here, http://wiki.roblox.com/index.php?title=Teleportation
it says to use cframe
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 07:32 PM
I'm so lonely.
I have this bad feeling nobody is helping me because the answer is super obvious..
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
02 May 2014 07:41 PM
Model:MoveTo ((Model:GetModelCFrame()*CFrame.new(0,0,-studz forwards)).p)
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 07:52 PM
I don't want to move it relative to itself. I just want to change it's position. I did some research, and I can't use MoveTo because the parent proprety of the model has to be Workspace.

References: http://wiki.roblox.com/index.php?title=Teleportation (CFrame versus MoveTo)
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 09:44 PM
Let me rephrase my question.
If you had a model that was completely welded, how would you move it?
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
02 May 2014 09:51 PM
I figured it out. Now it's worse.
The script that made the welds happened AFTER the script that moved the baseplate.
Even when I did wait(15) it still waited for the script to finish before it did the welds..
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
03 May 2014 07:21 AM
Bump.
Report Abuse
Hans3229 is not online. Hans3229
Joined: 05 Feb 2010
Total Posts: 109
03 May 2014 12:25 PM
Fine. I"ll make a new post about the order scripts go in.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image