|
| 16 Jul 2013 12:41 AM |
I Was using this script that I partly edited and it was ment to insert a model into the game at a certain position, but it didn't work, can someone fix it up for me?
asset = 122830184 --Insert The ID Of The Model Here model = game:GetService("InsertService"):LoadAsset(asset) model.Parent = game.Workspace model:MakeJoints() model.Name = "b"..asset game.b.Position = -577.641, 1.3, -340.74
This is what showed up in the output when I hit the play button:
17:35:49.984 - B is not a valid member of DataModel 17:35:49.985 - Script "Workspace.Insert Script", Line 13 17:35:49.986 - stack end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
| |
|
|
| 16 Jul 2013 12:55 AM |
| Read the whole thing through, I Put what the output window said AND What I wanted it to do.. If you read it all the way through .-. |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 16 Jul 2013 01:00 AM |
Erroring line: game.b.Position = -577.641, 1.3, -340.74 Issues: game.b does not exist. Position is a Vector3 value.
Solution (assuming that that was the only line with an issue...): model:MoveTo(Vector3.new(-577.641,1.3,-340.74)) |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 16 Jul 2013 01:01 AM |
Baheeg, you can use the 'model' variable that he created. Also, Vector3 is not a child or property of Position. 'b' still doesn't exist inside of game. His model is in Workspace (or game.Workspace), not in 'game'. |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 16 Jul 2013 01:13 AM |
'model' is a variable. Names are strings. 'model' was not Parented it to game, it was Parented to Workspace.
http://wiki.roblox.com/index.php/Variables
game.b122830184.Position.Vector3.new That is what you used when attempting to set the Position property. game.b122830184 does not exist. Also, if it DID exist, it would error because you're trying to access a property or child of the Position property called 'Vector3', which doesn't exist. You set the position TO a Vector3.
Finally, if what was added was not a BasePart (which has the Position property), but a Model, Hat, Tool (etcetera), then it wouldn't work. Because of this, you should try to use the MoveTo method. |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 16 Jul 2013 01:16 AM |
Read the wiki page.
I didn't say 'game.Workspace.Model', I said 'model'. 'model' is a variable that he defined. It refers to it, no matter what the name is. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2013 01:17 AM |
| Yeah, I wondered why the model wouldn't move to the set position, It just spawned in at sat there. Can you edit the script to use the move to method? |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 16 Jul 2013 01:18 AM |
Replace your positioning line with the one that I gave you. model:MoveTo(Vector3.new(-577.641,1.3,-340.74)) |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
|
| 16 Jul 2013 01:20 AM |
| You're the best. Thanks man. |
|
|
| Report Abuse |
|
|
lordsheen
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 608 |
|
|
| 16 Jul 2013 01:22 AM |
asset = 122830184 --Insert The ID Of The Model Here model = game:GetService("InsertService"):LoadAsset(asset) model.Parent = game.Workspace model:MakeJoints() model.Name = "b" model:MoveTo(Vector3.new(-577.641, 1.3, -340.74))
This thread replies were painful to read. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2013 01:29 AM |
| Thanks lord, now I don't have any annoying numbers :P |
|
|
| Report Abuse |
|
|