It Doesn't tween all the parts

  1. What do you want to achieve?
    To tween all the parts.
  2. What is the issue?
    Its only tweening one random part.
  3. What solutions have you tried so far?
    I tried doing something different but still didn’t work.

This is my script :strong text

local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
local Replica = game:GetService("ReplicatedStorage")

for i, model in pairs(CollectionService:GetTagged("Stars")) do
	print(model)
	local TweeningInformation = TweenInfo.new(
		2,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.Out,
		0,
		true,
		0
	)

	local PartProperties = {
		Color = Color3.fromRGB(170, 0, 255)
	}

	local Tween = TweenService:Create(model,TweeningInformation,PartProperties)




	while wait(10) do
		Tween:Play()
		print("Done")
	end
end

This makes the code yield forever and not run stuff after it. Try this

local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
local Replica = game:GetService("ReplicatedStorage")

local TweenTable = {}
local TweeningInformation = TweenInfo.new(
	2,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	0,
	true,
	0
)
local PartProperties = {
	Color = Color3.fromRGB(170, 0, 255)
}

for i, model in pairs(CollectionService:GetTagged("Stars")) do
	print(model)

	local Tween = TweenService:Create(model,TweeningInformation,PartProperties)
	table.insert(TweenTable, Tween)
end

while wait(10) do
	for i,Tween in pairs(TweenTable) do
		Tween:Play()
	end
	print("Done")
end

Still Doesn’t work. It doesn’t light up.

Did it print models that you need and “Done”? It works well for me, I even tested it on 700 parts

it printed all the models. But it didn’t change the color of all of them.

Can you send a file of all the objects that need to change color? If you can’t, send an image of the explorer of the objects and/or what it looks like?
It must be the models, the script works completely fine

I had the same problem and I fixed it with Coroutines and heres a fragment of my code for it
For some reason Collection Service seems to picks the first one out of the selected parts and executes that and it doesn’t seem to continue down the list until the first one has finished its code

for _,Spinny in pairs(Spinny) do
	local co = coroutine.wrap(function()
		while task.wait() do
			Spinny.CFrame = Spinny.CFrame * CFrame.Angles(0,speed,0)
		end
	end)
	co()
end

Let me try and I’ll tell you when it works or not.

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