Issues with making a tween to change size

I have been trying to make block change its size after a few seconds with a tween, but for some reason it returns me this:

image


(please ignore the fact that it instantly spawns a bunch of blocks lol)
heres the code:

 local function rocks(player)

	local sizeTable = {
		Vector3.new(1,1,1),
		Vector3.new(1.5,1.5,1.5),
		Vector3.new(1.8,1.8,1.8)
	}
	local angularTable = {
		Vector3.new(Random.new():NextInteger(-3,3), Random.new():NextInteger(0.6,1.1), Random.new():NextInteger(0.6,1)),
		Vector3.new(Random.new():NextInteger(-3,3), Random.new():NextInteger(0.6,1.4), Random.new():NextInteger(0.6,1.3)),
		Vector3.new(Random.new():NextInteger(-4.3,5), math.random(-3,2), math.random(-2,2))
	}
	local linearTable = {
		Vector3.new(0,Random.new():NextInteger(2,4), 0),
		Vector3.new(0,Random.new():NextInteger(3,6), 0),
		Vector3.new(0,Random.new():NextInteger(4,6), 0)
	}

	local sizeRNG = math.random(1,3)

	local newPart = Instance.new("Part", workspace.Trashcan)
	newPart.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(math.random(-8,8),1,math.random(-8,8))
	newPart.Size = sizeTable[sizeRNG]

	local newAttach = Instance.new("Attachment", newPart)

	local newAV = Instance.new("AngularVelocity",newAttach)
	newAV.Attachment0 = newAttach
	newAV.MaxTorque = 2
	newAV.AngularVelocity = angularTable[sizeRNG]
	local newLV = Instance.new("LinearVelocity", newAttach)
	newLV.Attachment0 = newAttach
	newLV.MaxForce = 1500
	newLV.VectorVelocity = linearTable[sizeRNG]

	task.wait(5)

	game:GetService("TweenService"):Create(newPart, TweenInfo(2, Enum.EasingStyle.Cubic), {Size = Vector3.new(0.01,0.01,0.01)}):Play()
	game:GetService("Debris"):AddItem(newPart, 2.1)
end

This is a function in a script, for some reason the tween returns me “attempt to call a table value”, if any of yall know why please let me know and thanks :pray:

I see the issue, as on the second parameter of TweenService:Create, you accidentally put TweenInfo() instead of TweenInfo.new().
Hope that solves your issue!

1 Like

oh that’s embarrassing of me, :sob: thank you!!

1 Like

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