I’ve been trying to make a reloading musket, but I was wondering how would I make the tool handles switch hands so it looks like the gun looks like it is being held by the other hand. Perhaps I should use
Cframe.Angles or something? I should also put it out there my gun uses welds to combine the gun parts together, not sure if that helps but it might. Thanks in advance!
Unfortunately, there isn’t any implemented method to switching which hand a tool is held in. Don’t worry though, you’re not out of luck. A good option is to weld the handle to your left hand.
Let me know if you need any help.
Try changing the tool’s
GripPos to a position mimicking the left hand holding the tool.
Tool.GripPos to a value offsetting the tool so that it is mimicking being in the other hand.
More information available here: https://developer.roblox.com/en-us/api-reference/property/Tool/GripPos
Thank you, this comment is very useful, however, the gun moves with the arm so it makes it difficult to simulate a reloading animation. How would I make the gun not move with the right arm movements?
Would you mind elaborating? What is going wrong? Could you post a video showing what goes wrong when offsetting the tool?
(The only reason is I can’t quite grasp what the problem is from you explanation, so can’t help very well)
I do apologize for my explanation. I can’t post a video but here’s a picture:
As shown, the gun sticks to the right arm. I want it to be held by the left arm while the right arm reloads the gun. I apologize if my explanation is too vague, hopefully this explanation was much clearer
Perhaps this helps as well, a picture of a guy reloading a musket:
Sorry but I do not believe this feature is possible yet. Even if you changed the grip pos, you will struggle animating it and making it work how you want too.
The best way to do this is by script connecting the musket to your players hand by creating a new Motor6D between the right hand and the musket handle. As in this tutorial:
And following the rest of tutorial, animate the hand with the musket as you wish to get the reload animation you want and then simply play it in the humanoid just as any other animation.
Just remember the Motor6D’s have to be attached the same way by script and when you animate. This may seem tedious and time consuming at first, but you will struggle more messing with CFrame Angles and grip pos to get a well made complicated reload animation.
In your case, I would consider possibly creating an animation for reloading. If you aren’t very skilled in math, this would probably be an easier solution.
This is exactly what I was looking for, Huge Thanks! I do, however, have some problems with it. I have success with animating the gun with the dummy, but it does not seem to animate when I play the animation in game. My character successfuly animates, however the gun doesn’t animate. Any ideas? thanks!
Glad I could help. Did you delete the old weld or what ever is attaching the tool to the hand made by default by the tool, and re attach it via code by making a new motor6D and connecting it as you did when animating.
Also everything is welded properly right?
I apologize for replying so late (couldn’t get my hands on a computer), but yes everything is welded properly, however I did not remove the weld made by tool and re attach it to a new motor6D. I was wondering if you would guide me step by step. Many Thanks!
Yeah then that is the issue. The Motor6D is needed for the animation.
- First, you will need to weld your gun parts to your handle.
- Go to play mode and equip your tool and go into the tool handle or possibly your characters right hand and see whatever is attaching the tool to the arm. Remember the name of it.
- In your tool code after welding delete that old object attaching the tool handle to your right hand.
- Create a new Motor6D just like when you were animating.
local HandleAttachment = Instance.new("Motor6D") HandleAttachment.Parent = nil -- change this to where the motor6D was when you were animating HandleAttachment.Part0 = nil -- change this to the right hand of the player HandleAttachment.Part1 = nil -- change this to the handle
If you have not already noticed, the code is basicly replicating the steps in this article:
But just through code.
I made these steps up on the spot, hopefully they work! Reply back if you run into any issues.
I’m so dumb I forgot to parent the motor6D. It finally worked after I fixed it up. Thank you for having the time to help me!
So glad it worked out!