Workspace.Model.Script:8: attempt to index nil with 'Position'

So, whenever I run the tweening script, I receive this error: Workspace.Model.Script:9: attempt to index nil with ‘Position’

Here’s the script I used:

local TS = game:GetService("TweenService")


local Model = script.Parent

local TI = TweenInfo.new(5, Enum.EasingStyle.Linear )

local Goal = {}
Goal.WorldPivot.Position = (1,0.5,10)

local Tween = TS:Create( Model, TI, Goal )

Tween:Play()

What did I do wrong?

6 Likes

You’re trying to get the WorldPivot of goal (the table), but you haven’t added that to the table, I’m assuming you meant to set goal to something else?

2 Likes

No, I want to goal the position of the Model. I used " Goal.Position " but there were no property called “Position”, so I used " Goal.WorldPivot.Position "

3 Likes

Then you have to make the path for the Model, and use that in the script

3 Likes

Can you edit my script please? Im just confused

1 Like

try:

local TS = game:GetService("TweenService")


local Model = script.Parent

local TI = TweenInfo.new(5, Enum.EasingStyle.Linear )

local Goal = {WorldPivot = CFrame.new(Vector3.new(1, .5, 10))}

local Tween = TS:Create( Model, TI, Goal)

Tween:Play()

Edit: No, it doesn’t work.

There are no errors, but the model still doesn’t move.

I mean all it does is change the worldpivot, if you want to change the position the best way to do it is to assign it a primarypart, then tween that. (make sure everything is connected to the primarypart with a weldconstraint and it’s not anchored)

1 Like

What part should I set as the primarypart?

any part you want, but probably the one in the middle if you are changing the position to that

Oh alright I get it. Thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.