this is a local script in the players backpack
while true do wait() game.Workspace.Model.Torso.Rotation = script.Parent.Parent.Character.Torso.Rotation end
Use CFrames instead. They're pretty complex so i suggest reading through this wiki page. http://wiki.roblox.com/index.php?title=CFrame
while wait() do local rot = script.Parent.Parent.Character.Torso.Rotation game.Workspace.Model.Torso.CFrame = CFrame.new(game.Workspace.Model.Torso.Position) * CFrame.Angles(math.rad(rot.X),math.rad(rot.Y),math.rad(rot.Z)) end
When you're dealing with setting the position or rotation of a part, you should always use CFrame. While the Position
and Rotation
property of all BaseParts are able to be written to, you should treat them as read-only. I'm not going to write out a tutorial on CFrame here, but I will give you the rundown.
Creating a CFrame
A new CFrame object can be created with the CFrame.new
constructor. There are several different constructors for creating different CFrames, but for now, you can treat it just like Vector3.new
in terms of passing XYZ coordinates. Example:
local newCFrame = CFrame.new(0, 5, 0) -- New CFrame object, with coordinates: X:0, Y:5, Z:0
Setting CFrame
You can set a CFrame object to the hidden CFrame
property of a part. I say hidden, because the CFrame property isn't shown in the properties window in studio. But it's there nonetheless. Example:
local newCFrame = CFrame.new(0, 5, 0) -- Assuming 'part' represents a BasePart part.CFrame = newCFrame
Instead of rotation being a different property, it's a form of manipulating a CFrame object. There's a constructor called CFrame.Angles
which you can multiply with a CFrame object created with CFrame.new
. It may sound like a lot to take in at once, but trust me, you'll get it down pretty fast.
You should also note that rotation is given in radians. To put radians into perspective, and to save some time explaining them, pi
(3.14...) is a number in radians that can represent half a rotation. You can access this value in Lua's math library as math.pi
. Example implementing rotation:
local newCFrame = CFrame.new(0, 5, 0) local newRotation = CFrame.Angles(0, math.pi, 0) -- Create new rotation that rotates 180 degrees on the Y axis. -- Set the CFrame of the part to the product of both position and rotation part.CFrame = newCFrame * newRotation
That's the basic rundown on CFrame and rotation. If you have any questions, just let me know and I'll get back to you as soon as possible.