TweenService:Create failed because Instance is null

Hello, I am Mark and recently I’ve been working on a Boss fight and I couldn’t get the spikes to tween themselves at the end of the ‘round of spikes’.
The solutions I’ve tried is checking its name before tweening and adding a “local a = x”, and neither of them worked

local stuff = workspace.Chapters.Chapter2.Spikes:GetChildren()
    for i, x in ipairs(stuff) do
        if x.Name == "Spike" then
            local a = x
            local TweenService = game:GetService("TweenService") 
            local tweenParts = a 
            local inform = TweenInfo.new(
                1,
                Enum.EasingStyle.Elastic, 
                Enum.EasingDirection.InOut, 
                0,
                false,
                0
            )

            local Goals = {           
                Position = Vector3.new(x.Position.X, 1,x.Position.Z), 
                Size = Vector3.new(1,1,1)
            }

            local PartTween = TweenService:Create(tweenPart, inform, Goals)
            PartTween:Play() 
            x.Material = Enum.Material.SmoothPlastic
            x["Damage Script"]:Destroy()
        end
    end
1 Like

Could it be that you have a typo in your script? tweenPart is only used in your script for the Create, I don’t see you declaring it anywhere, did you mean to pass in tweenParts?

Oh, I didn’t notice that, I will try if it’ll work.

Yep, that was the issue, thank you.

1 Like