Object Rotation

Hello everyone this is my first post on the devforum and I’ve been trying for 2 days to get this working but can’t figure it out!

I’m trying to get this Sword mesh to rotate where my arm is facing (like a tool) but if I rotate my character in different direction the sword orientation is different every time

Object (2)

local sword = meshes:WaitForChild("Sword"):Clone()
	sword.Parent = righthand
	sword.Position = Vector3.new(righthand.Position.X,righthand.Position.Y,righthand.Position.Z)
	sword.Orientation = Vector3.new(righthand.CFrame.LookVector,righthand.CFrame.LookVector,righthand.CFrame.LookVector)

try to make it with Angles

sword.CFrame = righthand.CFrame * CFrame.Angles(0,math.rad(90),0) – mess around with it

1 Like

Yes, but no.


I can’t get it like this (I just changed the rotation while I was in the game)

Maybe this video can help u out Improving Key Mechanics - Teddy Horror Gamedev #5 - YouTube 4:12

I’m dumb I didn’t think of moving the math.rad to a different axis

1 Like

You can always use CFrame to position it, try different values to find what fits your need.

Not sure if you need this, but there is a plug-in which allows you to position the weapon or anything where ever you want, I use this a lot since it doesn’t require the use of CFrames. The legit Plug-in!

I don’t recommend relying on plugins for objects especially in the case of positioning, because then there will be no freedom in positioning parts in the future or any type of code.

I get what your saying, but the initial position can be set, and you still have the freedom to change the position and orientation in the future.

1 Like