If its facing how I want it to when the orientation is 45,0,0 why is it facing down when i set it to 45,0,0 in the script??
local BG = Instance.new("BodyGyro", Object)
BG.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
BG.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(45,0,0)
BG.Name = "TKGyro"
while player and BP and TK[Object] do
wait()
BP.Position = (player.Character.RightHand.CFrame * CFrame.new(1, -1.25, 0)).Position
BG.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(45,0,0)
end
end
math.rad(45) means exactly that position, 45 degrees downward front, have you tried just removing the * CFrame.new() altogether? and what position does it partake when you do
I setup a dummy tool with a handle that had the visual part (blade) rotated by -45 deg on the X axis (to simulate the rotational offset).
I was able to run something close to this and got this working in one try:
local OFFSET = CFrame.new(1, -1.25, 0)
local ROT = CFrame.Angles(math.rad(45), 0, 0)
while true do
task.wait()
BP.Position = (rightHand.CFrame * OFFSET).Position
BG.CFrame = (root.CFrame * ROT)
end
So, you’re using cf * CFrame.new, which does relative positional offset (not changing rotation - so no impact), instead of cf * CFrame.Angles which you need to supply radians to.
If you’re unable to get this to work, your BP and BG properties need fine tuning, also the effect itself isn’t great since movement of the hand will cause the blade to not really be stable.
First of all, BodyGyro is deprecated, deprecated stuff are deprecated because there’s a more efficient way of doing it or because it was buggy and inaccurate. You should be using AlignOrientation. And as the name suggest, AlignOrientation aligns orientation.
Secondly, how do you use AlignOrientation?
Well it there’s a lot of factors on how it can be used, though I’ll only be focusing on the mode and MaxTorque, the things you should also only care about when looking at your post.
When you make an AlignOrientation it defaults to “TwoAttachment”
TwoAttachment mode is when you use 2 attachments (wow who knew), and if you rotate attachment 1, attachment 0 will follow.
OneAttachment mode (The one you should use), as the name suggest, uses one attachment. Using OneAttachment mode will open up a new CFrame property in the AlignOrientation(scroll down to find it). It’ll also make Attachment0’s orientation follow whatever orientation you set the AlignOrientation’s orientation as.
MaxTorque affects how much, I guess, power should be used in rotating Attachment0, the higher it is, the easier it is for it to rotate the attachment, in this case, you should just set it as a high number like 999999, set it higher, if, for some reason the knife doesn’t rotate.