Tweening the position of a part with a weld

Hi!

I’m having some issues with getting the position of a part to tween while welded. What happens is that when I try to resize it works, but when I change it’s position it breaks the weld.

I’m trying to make a bubble blower look more “normal” and not appeal in the middle of the characters stick. (gif below)

I tried changing the position the same way I changed the size but it didn’t work, and the weld still breaks and doesn’t follow the stick. (gif below) But it does work in the way I wanted to with the position offset.

Calling the function:

actualStick.Activated:Connect(function()
    if debounce then
        debounce = false
        module.Lift()
        blowSound:Play()
        local pos = player.character:FindFirstChild("stick").Handle.Position

        firstAnimation(blowTrack)
        newBubble:Create("rbxassetid://6257259618", pos)
        actualStick.Handle.Weld.Part0 = actualStick.Handle
        actualStick.Handle.Weld.Part1 = newBubble.bubble

        local weldPosition = actualStick.Handle.Weld.C0 --SETTING WELD POSITION

        --run animation
        newBubble:Animate(weldPosition) --calling it here 
        actualStick.Handle.Weld.Part1 = nil
        newBubble.bubble.Anchored = true
        wait(cooldown)
        debounce = true
    end
end)

Creating the animation function:

--[[
FUNCTION DESCRIPTION:
Animates the bubble, first it makes it go from small to large,
and then makes it bounce up and down once its the correct size.
]]--
function bubble:Animate(weldPosition)

    local smallToLarge = TweenService:Create(
        self.bubble, 
        TweenInfo.new(1.5),
        {
            Size = Vector3.new(5,5,5),
            Position = weldPosition + Vector3.new(5, 5, 5) --ERROR ON THIS LINE
    })

    smallToLarge:Play()
    smallToLarge.Completed:Wait()
    
    local idleBounce = TweenService:Create(
        self.bubble, 
        TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true, 0), 
        {
            Position = Vector3.new(self.bubble.Position.X, self.bubble.Position.Y+3, self.bubble.Position.Z)
        })
    
    idleBounce:Play()

end

My error on the code above is:


TweenService:Create property named 'Position' cannot be tweened due to type mismatch (property is a 'Vector3', but given type is 'CoordinateFrame') - Client - bubble:50

Which I know how to solve, (Position is supposed to be a Vector3 but i’m passing in a CFrame).

But what I’m stuck on is just how to do it? I don’t understand how to tween the position of the bubble if “Position” only accepts Vector3 but I need to use CFrame for weld which is incompatible? How would I tween the C0 on the weld instance?

Thanks! :sob:

(also, the Weld is only on the stick and not on the bubble)*

1 Like

Change the erroring line to

weldPosition.p + Vector3.new(5, 5, 5)

and see if it still errors.

Try adding an invisible part to the side of the bubble that welds onto the tool when you’re blowing the bubble and then destroying the part when it’s not being blew.

So it doesn’t error anymore, but all the bubbles appear from a random location and go to the middle of the map.

It also doesn’t follow the stick while expanding like in the first gif (which is what I need)

Wrong.

1 Like

Thats because the original C0 won’t be changing, it’s the CFrame relative to C1.
Try constantly updating C0 and see if it makes a difference. Also use WeldConstraints instead of ManualWelds if you aren’t already.

By constantly updating the C0 do you mean in a while loop? Isn’t there an easier way of doing this? (I hope)

Also was using WeldConstraints at first, but then they don’t have the C0 property so I switched to using Welds.

I’d like to help you but I can’t really solve a problemo like this on phone.
Just avoid using the weld’s C0 or C1 and since your game is set to R15 characters, use the (RightHand)? Since the “stick” seems like it just uses an attachment rather than an animation.
Character.RightHand.Position + Vector3.new(x, y, z)