How to make tank turret turn

Ok. So I’m making some tanks for my game and I need the turret to follow the mouse on the x-axis and the barrel to follow the turret but also follow the mouse on the y-axis. Kinda confusing so here’s a video of what I mean. (Turn down your volume because it’s kinda loud.)

Does anyone know how to do this? I’ve looked around but I can’t find exactly what I’m looking for
(sorry if I am being dumb and this is really easy to do lol)

1 Like

I believe HingeConstraint | Documentation - Roblox Creator Hub is what you’re looking for.


You could use, lookat). If it’s a model you would have to use :SetPrimaryPartCFrame(cframe).

1 Like

I think its something like a cannon. Here’s a post where BanTech explained how use Constraints to make the cannon able to rotate around both axes at the same time. When you want the turret to follow the players mouse you need to check whether the mouse position changed. You need to look through the mouse object whether there are functions or properties that are useful for you.

1 Like