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!
(also, the Weld is only on the stick and not on the bubble)*