I am using CollectionService to try to use only 1 script for making parts gradually turn RED then fall/UnAnchor but only work with 1 at a time so I am trying to use coroutine (Have never used before) and any help would be amazing thank you!
Error: Can not resume dead coroutine - Client
local collectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
local TweenSpeed = 4
local TweenFunction = TweenInfo.new(TweenSpeed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0)
for _, parts in pairs(collectionService:GetTagged("DropPart")) do
local dropPart = coroutine.create(function()
parts.Material = "Neon"
local OGcolor = parts.Color
local partPosition = parts.Position
local player = game.Players.LocalPlayer
local color = Color3.fromRGB(255, 0, 0)
TweenService:Create(parts, TweenFunction, {Color = color}):Play()
wait(3.5)
parts.Anchored = false
wait(2)
parts.Anchored = true
parts.Position = partPosition
parts.Color = OGcolor
end)
parts.Touched:Connect(function()
coroutine.resume(dropPart)
end)
end