TweenService:Create no property named 'Position' for object 'OriginalPosition'

Okay, so I’m working on some sort of script that moves a table of models up above the sky.
I’m storing the OriginalPosition and SkyPosition inside these crates.
This is my code:

local Crates = workspace.Crates
	for _, crate in next, Crates:GetChildren() do
		
		local a = Instance.new("Vector3Value", crate)
		a.Name = "OriginalPosition"
		a.Value = crate.Center.Position
		
		local b = Instance.new('Vector3Value', crate)
		b.Name = "SkyPosition"
		b.Value = crate.Center.Position + Vector3.new(0, 250, 0)
		
		for _, cratePart in next, crate:GetChildren() do
			local pos  = {}
			pos.Position = b.Value
			
			local New = TweenService:Create(cratePart, TweenInfo.new(13), pos)
			New:Play()
		end
	end

If anyone knows what is causing this error to happen and how I can fix it that’d be hugely appreciated.

7 Likes

You aren’t checking the ClassName of the children you’re iterating through and confirming they’re BaseParts.

for _, cratePart in next, crate:GetChildren() do

This here, you’re iterating through the children of the crate. The Vector3Values you created are children of the crate, therefore they’re also included in the loop. Vector3Values don’t have a Position property.

On a separate note, you should get into the habit of setting the properties first before the parent.

4 Likes

Thank you, I’m struggling to notice these small issues.

2 Likes