How would I tween a weld?

To provide more context, I have this flashlight model welded to the character’s right hand with an animation for holding it and I want to make a subtle recoil like motion for the flashlight once its turned on/off. Basically rotating it a few degrees forwards and backwards simulating a force of pressing the button on it.

My question is what is the best approach for this?
The only viable options I have thought of is tweening the weld but there could be a better way plus I am not too sure on how to do that.
The other (easier) choice that I know how to do is to have another animation that moves the lower right arm (therefore moving the flashlight welded to the right hand) but I would still want to learn about the 1st option.

2 Likes

I think its possible to Tween the Weld.C0 or C1, those are CFrames. So you could use for Goal parameters of the Tween, CFrame I guess, or maybe C0?
Im gonna give it a quick try.

EDIT: Yup, you can use C0 or C1 as the Goal parameters

The quick test I made (not really needed I think, but yeah…):

local TS = game:GetService("TweenService")
local Info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, true)
local Goal = {C0 = script.Parent.Weld.C0 * CFrame.Angles(math.rad(0),math.rad(0),math.rad(30))}

task.wait(5)
warn("playing tween")
TS:Create(script.Parent.Weld, Info, Goal):Play()
1 Like

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