Making a really simple custom tool script that snaps an object to your hand when you click on it using a RigidConstraint. I want the right arm to extend outward and not be affected by player animations while holding something, the same way it works when you hold a tool.
For some reason everyone says the easiest way is to do this is to make a copy of the default animations and remove the arm keyframes, which seems like a really stupid and inefficient way to solve such a simple issue. After all, Roblox themselves figured out how to stop the arm from animating without doing all that, so why should I?
I’m assuming you mean an object not being held by the player like a typical tool, use an IKControl that only affects the arm and set the target to the thing you want
If you mean a regular tool, Animations (Property of AnimationTracks) have Priorities ) an animation with a higher priority will override the keyframes of the lower priority animation, just have an animation only affecting the parts of the character that you want affected (Example; no keyframes on the torso will mean it doesn’t override another animation affecting the torso)
Edit: messed up the links
My StarterCharacter is an R6 rig, so I’m not sure if IKControl will work (at least, I couldn’t figure it out but maybe I’m just stupid). Is there another way? How does Roblox do it when you’re holding a tool?
And yes, the object in question isn’t a tool.
Okay you do mean the second thing, IKControls do work with R6, but if you’re just using tools you just need an animation, create an animation that only affects the right arm and set it to an animation priority higher than core (Roblox base animations all have core priority)
To play it, all you have to do
--First we load the animation
local Animation=--Your animation instance
local Animator= --Animator instances are automatically made under Humanoids, you can make one if it doesn't happen
local AnimationTrack=Animator:LoadAnimation(Animation)
--If you've forgotten to change Looping or Priority you can do it here
AnimationTrack:AdjustWeight(weight,fadeTime)
AnimationTrack.Looped=true --If false it will not repeat after finishing it's keyframes
--And you just play it (the parameters are not necessary, but you can configure them if you want
AnimationTrack:Play(fadeTime,Weight,Speed)
I edited this into my reply afterwards to specify, sorry.
If it helps, the object in question is a soccer ball. My original idea was to add a tool into the player’s inventory and weld the ball to the tool when clicked on, but it was pretty janky and overall didn’t work like I wanted. I also thought of having an extra soccer ball as the tool itself, and deleting the original soccer ball from the field when the tool is equipped. This would break any scripts the original soccer ball used, though. Overall I thought it would be simpler to not use a tool at all and just attach the soccer ball to a player’s hand when it is clicked on.
If it isn’t too much trouble for you, could you demonstrate how to use IKControls with R6? This is the closest I’ve gotten to a solution:
“g” in this case is the semi-transparent arm seen in the video. Position, Rotation, and Transform don’t change the Right Arm at all, while LookAt makes it go crazy.
The IKControl targets the position of the part, since it overlaps the arm it’s just setting it to itself (kindoff).
Seeing the actual thing you want to achieve i think there’s a better solution, just welding the ball to the player’s hand, try creating a weld in character’s hand, set Part0 to the arm and set C1 to half the arm’s length+ half the ball’s radius, then when the player has the ball set the Part1 to the ball, i would also parent the ball to the player during this and in the ball’s script check whether it’s parented to a player before doing any of it’s functions, and set it back to workspace or it’s designated parent when dropped and also setting Part1 in the weld to nil
I’m already doing this. As I said in my original post, I’ve made code that attaches the ball to the character’s right arm with a RigidConstraint and it works fine. The issue is the right arm still animates, which I don’t want to happen. I already tried swapping it out for a Weld instead, and the arm still animated.
I’m asking for a simple way to stop the right arm from animating when the ball is attached to it. It seems IKControl still moves with your animations a little (I want the arm to be completely frozen), so I don’t think this is an answer either.
Again, roblox figured this out ages ago with tools, it has to be something really simple.
Aaaaah I understand now, either figure out how to do it without tools or copy the animate that Roblox automatically adds on characters, insert it to your character and remove the part of the code that plays the that animation (Roblox doesn’t add the “Animate” script if another one with the same name already exists in the character)
either figure out how to do it without tools
…very helpful.
I decided instead to duplicate the right arm and rotate it to extend outwards, and make it visible whenever the soccer ball is clicked on. It’s a bandaid fix but the only other way is to make an animation that does the same thing which is slightly more work.