Tweens wont play

I have done this dozens of times but for some reason the tweens wont play in this little script. The parts properly clone and parent to workspace. All parts are anchored but after parenting, they just sit there.

Can anyone see why?

    local TweenService = game:GetService("TweenService")

    local fastBall = ReplicatedStorage.EffectParts.Abilities.MeleeAttack.BasicHeavyPunch.FastBall:Clone()
    local shockRing = ReplicatedStorage.EffectParts.Abilities.MeleeAttack.BasicHeavyPunch.Shock:Clone()
    Debris:AddItem(fastBall, 3)
    Debris:AddItem(shockRing, 3)

    fastBall.CFrame = initCharacter.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,-7))
    fastBall.Parent = Workspace.RenderedEffects

    shockRing.CFrame = initCharacter.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,-7))
    shockRing.Parent = Workspace.RenderedEffects

    local ballTransparency = TweenService:Create(fastBall, TweenInfo.new(1), {Transparency = 1})
    local ballPosition = TweenService:Create(fastBall, TweenInfo.new(1), {Position = fastBall.Position + Vector3.new(0, 0, 4)})

    local shockTransparency = TweenService:Create(shockRing, TweenInfo.new(1), {Transparency = 1})
    local shockPosition = TweenService:Create(shockRing, TweenInfo.new(1), {Position = fastBall.Position + Vector3.new(0, 0, 1)})

    ballTransparency:Play()
    ballPosition:Play()
    shockTransparency:Play()
    shockPosition:Play()

Try adding a Heartbeat.Wait() or regular wait() in-between playing the tweens?

i have ever had to do that, i think that would be bad practice anyway.

None of the tweens play, not even the first one

Hm, could you implement print statements to debug where the issue could lie?

You can shorten this down into two tweens, to start off with. You can tween multiple properties within the same tween:

local info = TweenInfo.new(1)
local pos = fastBall.Position + Vector3.new(0, 0, 1)

local ballTween = TweenService:Create(fastBall, info, {Transparency = 1, Position = pos})
local shockTween = TweenService:Create(shockRing, info, {Transparency = 1, Position = pos})

ballTween:Play()
shockTween:Play()

Thanks, I know I can do that. I have other reasons in my code it is presented the way it is. Its also not a solution to my issue.

Maybe do GetService(“ReplicatedStorage”), and WaitForChild(), because the models and services might not have loaded yet.

I’m still looking at your code, I just wanted to point that out. If you play two tweens for the same instance at the same time, the previous tween will be cancelled.

i added a print:

    while true do
        print(fastBall.Position)
        wait()
    end

It does indeed show to position of the part tweening, but it doesn’t move on the screen at all.

For what its worth, these operations are being done of the client.

Thats odd, do you have a reference that tweens get cancelled? I have done that many times without issue.

Also, just to be sure, I reduce the script down to a single tween.

    local fastBall = ReplicatedStorage.EffectParts.Abilities.MeleeAttack.BasicHeavyPunch.FastBall:Clone()
    local shockRing = ReplicatedStorage.EffectParts.Abilities.MeleeAttack.BasicHeavyPunch.Shock:Clone()
    Debris:AddItem(fastBall, 3)
    Debris:AddItem(shockRing, 3)

    fastBall.CFrame = initCharacter.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,-7))
    fastBall.Parent = Workspace.RenderedEffects

    shockRing.CFrame = initCharacter.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,-7))
    shockRing.Parent = Workspace.RenderedEffects

    --local ballTransparency = TweenService:Create(fastBall, TweenInfo.new(1), {Transparency = 1})
    local ballPosition = TweenService:Create(fastBall, TweenInfo.new(1), {Position = fastBall.Position + Vector3.new(0, 0, 4)})

    --local shockTransparency = TweenService:Create(shockRing, TweenInfo.new(1), {Transparency = 1})
    --local shockPosition = TweenService:Create(shockRing, TweenInfo.new(1), {Position = fastBall.Position + Vector3.new(0, 0, 1)})

    --ballTransparency:Play()
    ballPosition:Play()
    --shockTransparency:Play()
    --shockPosition:Play()

    while true do
        print(fastBall.Position)
        wait()
    end

the fastBall part prints do show the position changing, but the part does no move on screen!

WHAT!?

I am truly mystified

I think you would have to do this on the Server.

absolutely not, but thank you. TweenService works perfectly fine on the Client

image
https://developer.roblox.com/en-us/api-reference/class/Tween

I did realize, however, that your two tweens are tweening two different properties rather than tweening the same properties; therefore not causing a tween conflict. However, it is better practice to tween both properties in the same tween. There are some small performance benefits as well.

1 Like

yup. Well still not tweening and I am literally pulling my hair out! I have dozens of other tweens just like this, I literally copy pasted most of the code from a similar script.

This might not help, but how about you try this instead:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local info = TweenInfo.new(1)

local fastBall = ReplicatedStorage.EffectParts.Abilities.MeleeAttack.BasicHeavyPunch.FastBall:Clone()
fastBall.CFrame = initCharacter.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,-7))
fastBall.Parent = Workspace.RenderedEffects

local shockRing = ReplicatedStorage.EffectParts.Abilities.MeleeAttack.BasicHeavyPunch.Shock:Clone()
shockRing.CFrame = initCharacter.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,-7))
shockRing.Parent = Workspace.RenderedEffects

local pos = fastBall.Position + Vector3.new(0, 0, 1)
local ballTween = TweenService:Create(fastBall, info, {Transparency = 1, Position = pos})
local shockTween = TweenService:Create(shockRing, info, {Transparency = 1, Position = pos})

ballTween:Play()
shockTween:Play()

ballTween.Completed:Wait()
shockTween.Completed:Wait()

fastBall:Destroy()
shockRing:Destroy()

I am starting to think this is a WeldConstraint bug again. I have more issues with WledConstraints than I can express.

I set up a test with a simple part and it tweens fine without any issues. Bu if i try to tween the Position of a simple welded assembly it wont move.

I changed the tween property to CFrame like this:

local fastBallPosition = TweenService:Create(fastBall, TweenInfo.new(1), {CFrame = fastBall.CFrame:ToWorldSpace(CFrame.new( 0, 0, -8))})

and it works fine. I did not change the part assembly in any way. So for some reason I can tween CFrame but not Position of a welded assembly.

Hey, just a heads up.
This is not a bug, it is an intended feature. If you read the documentation for WeldConstraints it states that the offset of the welds will be adjusted when changing part positions. However, it states that changing the CFrame of a welded part will move the entire assembly.

Hope this cleared up some confusion for you!

2 Likes