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 » Game Design
Home Search
 

Re: Moving models problem.

Previous Thread :: Next Thread 
StrategyGames is not online. StrategyGames
Joined: 02 Dec 2006
Total Posts: 3677
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
StrategyGames is not online. StrategyGames
Joined: 02 Dec 2006
Total Posts: 3677
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 is not online. 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
StrategyGames is not online. StrategyGames
Joined: 02 Dec 2006
Total Posts: 3677
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 is not online. 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
StrategyGames is not online. StrategyGames
Joined: 02 Dec 2006
Total Posts: 3677
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 is not online. 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
StrategyGames is not online. StrategyGames
Joined: 02 Dec 2006
Total Posts: 3677
24 Dec 2014 07:27 PM
Do I need to define a primarypart? if so how?
Report Abuse
maxomega3 is not online. 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
StrategyGames is not online. StrategyGames
Joined: 02 Dec 2006
Total Posts: 3677
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
StrategyGames is not online. StrategyGames
Joined: 02 Dec 2006
Total Posts: 3677
24 Dec 2014 08:17 PM
Fixed it, thank you for your help max.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Dec 2014 09:44 PM
No problem!
Report Abuse
Pissnir08 is not online. Pissnir08
Joined: 19 May 2017
Total Posts: 1
25 Nov 2017 07:02 AM
i doesnt work
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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