Only One Tagged Moving Part Works at a Time

I have encountered a problem in my project involving platforms tagged as “movingPlatforms.” While tagging multiple platforms with this tag, it appears that only one platform can move at a time. When that platform is removed, the next one works as expected, but no others do. I am looking for solutions, as I am unsure whether the issue lies in the script implementation or elsewhere in my setup.

The platforms are tagged consistently. My goal is to ensure that all tagged platforms can move properly without a problem. Any Suggestions, or solutions you could provide would be greatly appreciated. – There are currently no errors in the output and yes MovingPlatform is the one tagged.

local CollectionService = game:GetService("CollectionService")

local function makePart(part)
	local platformDelay = 6

	local attachment1 = part.Parent:WaitForChild("startPoint"):WaitForChild("Attachment1")

	while true do
		wait(platformDelay)
		attachment1.Parent = part.Parent:WaitForChild("endPoint")
		wait(platformDelay)
		attachment1.Parent = part.Parent:WaitForChild("startPoint")
	end
end

for _, actionPart in pairs(CollectionService:GetTagged("movingPlatform")) do
	makePart(actionPart)
end

Try encapsuling your makePart(actionPart) inside of task.spawn(), your while loop could be yielding the execution of the for loop.

task.spawn(function()
     makePart(actionPart)
end)

Awesome dude thanks, that worked wonders.

1 Like

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