|
| 24 Dec 2014 06:37 PM |
I am storing items in server storage, but when I move them to workspace with a script, it puts them ontop of the other models that are in the same location.
How do I make it move to the correct position as I want it inside the other model. |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2014 06:53 PM |
at the moment I am trying
local cf = model:GetModelCFrame() model.Parent = game.Workspace model:Moveto(cf) |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Dec 2014 06:55 PM |
Three things wrong with that script: 1) :GetModelCFrame () is deprecated, although I forgot what replaced it (the wiki will say) 2) :GetModelCFrame () returns a CFrame, while MoveTo () needs a Vector3 3) You are trying to move the model to its own location |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2014 07:07 PM |
Exactly, I am cloning a model from serverstorage and putting it into workspace, when I put it into workspace it isn't at the correct position due to other things in the way.
Hence me getting the position of the model in SERVERSTORAGE, and trying to move the model to its position.
in the actual script its upgradeStuff instead of model, but I made it all model for the simplicity of this post.
Thanks for your response, but could you provide me with a solution to my problem instead of telling me that my attempt is incorrect. I know it is incorrect, that is why I am asking for help here. |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Dec 2014 07:12 PM |
I'm pointing out what is incorrect, so that you may try to fix it yourself. I'm sure that you didn't know :GetModelCFrame () is deprecated and that :MoveTo () takes a Vector3 argument
That means you can't use MoveTo (), as Vector3 will not insist on its location as CFrame does |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2014 07:17 PM |
| I am not finding any solution around this problem, thank you for telling me what is incorrect, the problem is I can not see any correct way to sort out this problem. |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Dec 2014 07:26 PM |
Your solution (and replacement for GetModelCFrame):
local cframe = model:GetPrimaryPartCFrame() model.Parent = Workspace model:SetPrimaryPartCFrame (cframe) |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2014 07:27 PM |
| Do I need to define a primarypart? if so how? |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Dec 2014 07:28 PM |
Not necessary, although you CAN set it
http://wiki.roblox.com/index.php?title=API:Class/Model |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2014 07:46 PM |
Error:
Model:GetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2014 08:17 PM |
| Fixed it, thank you for your help max. |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
| |
|
| |
|