Unable to cast value to Object

I’m making an intro for my game, and i got some errors in the Tweening script:

local ts = game:GetService("TweenService")
local logo = script.Parent.Logo
local text = script.Parent.Name
local BG = script.Parent.BG

local TextIn = ts:Create(
     logo,
     TweenInfo.new(
           2,
           Enum.EasingStyle.Quad,
           Enum.EasingDirection.Out,
           0,
           false,
           0
     ),
     {
           Position = UDim2.new(0.227, 0,0.379, 0)
     }
)

local TextOut = ts:Create(
     logo, 
     TweenInfo.new( 
           2, 
           Enum.EasingStyle.Quad, 
           Enum.EasingDirection.In, 
           0, 
           false, 
           0 
     ),
     {
           Position = UDim2.new(0.117, 0,0.379, 0)
     }
)

local LogoIn = ts:Create(
     text, 
     TweenInfo.new(
           2,
           Enum.EasingStyle.Quad, 
           Enum.EasingDirection.Out,
           0,
           false,
           0 
     ),
     {
           Position = UDim2.new(0.551, 0,0.395, 0)
     }
)

local LogoOut = ts:Create(
     text, 
     TweenInfo.new(
           2,
           Enum.EasingStyle.Quad,
           Enum.EasingDirection.In,
           0, 
           false,
           0 
     ),
     {
           Position = UDim2.new(0.117, 0,0.379, 0)
     }
)



TextIn:Play()
LogoIn:Play()

wait(4.5)

TextOut:Play()
LogoOut:Play()

`

The problem is that a line is error printing:

Unable to cast value to Object.

Which is in the line 47:

Position = UDim2.new(0.551, 0,0.395, 0) --LogoIn

I don’t know why that is happening, thanks for responding :+1:

The script will actually assume that you want to index the guiobject’s name at local text = script.Parent.Name. The solution would be to use FindFirstChild:

local text = script.Parent:FindFirstChild("Name")