Trying to make object rotate but when moved, rotate with other parts orientation

It’s really hard to explain, but basically I am trying to make this saw weapon have a rotating saw, however if I move around with the weapon, it keeps staying in the same direction instead of rotating with the weapon, I know it has something to do with lookat, I just have no idea how to utilize it here. The best way I can show this is with a video, I will also show my script and how the weapon is welded and such, please help if you know what is wrong, the video was to big so i could only send it via streamable:

External Media

image

What is that script for? It just looks like that if you disable it then it would rotate properly

The script is what’s making it rotate in the first place, if I disabled the script, nothing would happen.

I’m confused, how does it rotate it? Like with the animation itself, since the only thing that it seems to be doing is setting it’s orientation to 360, 0, 0, which would be rotating it to be in the same spot, but not really rotating it like a saw

I don’t know what to tell you, the tween is rotating it, there is no animations involved.

You do not really need a script for this if the rotation should be constant.
Here is images of all the correct setup, in my example Coin1 is the thing Rotating, and Hitbox is the non-Rotating Part, that the Rotating Part is attached to.
Also make sure that the rotating part is either non-cancollideable, or that the two parts has a custom collisiongroup, that does so they cannot collide with each other.
image



image

1 Like

I’m confused, how does it rotate it? Like with the animation itself, since the only thing that it seems to be doing is setting it’s orientation to 360, 0, 0, which would be rotating it to be in the same spot, but not really rotating it like a saw

Yes this seems really weird, that your weld still works, even though orientation is overwritten.

Anyways for this to work, you should tween C0 property of the weld, rather than the part itself. I also suggest replacing the weld with Motor6D, as tweening other welds connected to humanoid result in weird behaviour.

Since C0 is a CFrame property, you cannot use Orientation to tween it. This has a consequence of maximum of 180 turn. CFrame tweens always use the shortest path to the target orientation. To be able to get full 360 turn you need at least 2 tweens. For an ability to control the direction as well, I suggest a set of 3 tweens.

Here’s how I would do it:

local blade = script.Parent.Parent.PrimaryPart

local rotatingBlade = blade:Clone()
rotatingBlade.Parent = blade.Parent

blade.Transparency = 1

local motor = Instance.new('Motor6D')
motor.Parent = blade
motor.Part0 = blade
motor.Part1 = rotatingBlade



local tweens = {
	TS:Create(motor,tweenInfo,{C0 = CFrame.Angles(math.rad(120),0,0)}),
	TS:Create(motor,tweenInfo,{C0 = CFrame.Angles(math.rad(240),0,0)}),
	TS:Create(motor,tweenInfo,{C0 = CFrame.Angles(0,0,0)}),
}

for i, tween in pairs(tweens) do
	
	tween.Completed:Connect(function()
		tweens[i%3 + 1]:Play() --play the next tween
	end)
	
end

tweens[1]:Play() -- start the first tween

You probably want to reduce the length of the tween to 1 second, as each one will make 1/3 of a turn.

If the blade is rotating the wrong way, swap any of the tweens around.

If the blade is rotating in the wrong axis, put math.rad() in different spot, ie: CFrame.Angles(0,0,math.rad(120))

1 Like

Thanks a ton, I wasn’t able to respond quickly due to school, but after a few tweaks to the script it started working.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.