How Can I Make a Tool With an Animation Move With A Player’s Camera?

Hello everyone!
I’m trying to make the flashlight in my game move with the player’s camera when they are in first person mode. I’m using an animation for when the player is holding the flashlight, which keeps it in one place which makes it extremely hard to see when you aren’t looking directly in front of your character. I’m using the flashlight from Doors as an inspiration, as it moves along with the camera, but your player still has a custom holding animation different from the default arm in front of your character.

robloxapp-20231026-1845422.wmv (599.1 KB)
This is what I’m aiming to accomplish.

I’m fairly new to game development as a whole. I’ve tried researching for hours trying to find something that works, but everything I tried either just makes the arm go inside of the player or doesn’t work at all.

Any help would be greatly appreciated!

They are using viewmodels, they just get arms and attach to the camera and make it hold a tool and play an animation basically.

You can use this tutorial, might be similar to what you want:

Thank you. I’m still a little confused about the viewmodels. I already have it set up so the player can see their own character in first person, so would I just have to edit the arm’s position every frame? I can send a video of what I have right now if that will help.

Just give the viewmodel a Humanoid, or in other words make it a rig (like if it was a character). So that way you can make animatable. And what do you mean by ‘the player can see their own character in first person’

I mean that you can look down and see your character when in first person, as roblox usually makes your character completely invisible in first person.

If I created a duplicate character like how a viewmodel works, would I have to reanimate everything? Right now I’m just using the default roblox animations and stuff just to make it feel like the player can have some freedom with their avitars. When animating the flashlight, I already have an idle, turning on animation, and a using animation. Would I have to remake those as well?

Depends, but I would say yes. Since what you could do is paste the keyframes into the animator editor (thats animating the viewmodel), but depending on how your viewmodel is created it may not work. You could try.

Also, can I see your viewmodel?

robloxapp-20231111-2109376.wmv (1.4 MB)

It’s quite literally just the player’s character

If you want to work from there, you could make it so that the player’s body follows the camera like in PLS DONATE (but better)

That’s kind of what I’ve been trying to do, the only problem is that I have a holding animation that I don’t really know how to fix so it will follow the camera. Any ideas of how I could go about that without having to make a viewmodel and all of that stuff?

Elaborate?

fhdugius

robloxapp-20231111-2139285.wmv (2.0 MB)

I’m not sure how to make the arm follow the camera while an animation is playing, as shown in the video. The animation that I have when the player is using the flashlight is custom and completely changes the arm’s position.

Yeah, that’s why you make it so the body follows the camera. There’s scripts out there for that and the torso will move according to where the camera points and since the arms welded to the torso, it would follow it.

Alright thanks. Do you know of a script or tutorial that has a good reputation or that you would recommend, or do you think that any would be good?

I tried to find something, but this could work.

Thank you! The only problem I have now is that the camera kind of just floats above the player’s body when they’re looking down. I tried to make the camera subject the player’s head, which had an interesting effect, but there were a bunch of other stuff that I’d have to fix if I were to do that. Do you have an idea of what I could possibly do?

Also, thank you so much for your help. I’m kind of a beginner when it comes to this stuff and I greatly appreciate your time helping me.