It is pretty simple.
Since models have a PrimaryPart, many model functions provided by ROBLOX use this part as reference.
##1. Setting your own primary part
It is the pretty simple. Click on the PrimaryPart and select the part you want as the primary part. Done!
If you didn't understood, click here
##2. :MoveTo()
Moves the center of the PrimaryPart to the position you given to it. Any other parts the model contains will follow it. Uses Vector3.new()
game.Workspace.Model:MoveTo(Vector3.new(1,1,1)) - moves the PrimaryPart to 1,1,1
However, since it uses Vector3, if the position isn't free of any obstacles, the part will be moved on Y axis until a "free" zone is found.
##3. :SetPrimaryPartCFrame()
Basically the same thing as :MoveTo(), but ignores any obstacles, and you may rotate it.
NOTE that if you don't set a rotation, it is reset to 0,0,0!. By other side, the rotation input is on radians and not degrees!
Uses CFrame.new() and CFrame.Angles()
game.Workspace.Model:SetPrimaryPartCFrame(CFrame.new(1,1,1)) * CFrame.Angles(math.pi, math.pi/2, math.pi) - moves the PrimaryPart to 1,1,1, and rotation to 180,90,180.
The formula to convert degrees into radians is r = math.pi*(d/180), in wich d is the value in degrees, and r is the value in radians. You could use math.rad() to convert, but I wouldn't recommend that.
Hope I helped!
1 comment
Thanks a lot! Now i can finally finish my script