For loop tweening won't work

Code snippet in EventScript:

for i, part in pairs(script.Parent.RiseUp:GetDescendants()) do
	if part:IsA("BasePart") or part:IsA("MeshPart") then
		TS:Create(part, RisingInfo, {Position = part.Position + Vector3.new(0, 800, 0)}):Play()
	end
end

Explorer:
image

I literally have no idea why, but this code won’t work. I’ve been staring at it for more than half an hour now and can’t find what’s wrong with it. TweenService is gotten correctly as the variable TS, All the children of RiseUp are MeshParts, and there are no errors in the Output. The code just won’t work. How do I fix this??

Just spitballing here but it looks like that EventScript isn’t activated according to your explorer screenshot

try this:

local tween = TS:Create(part, RisingInfo, {Position = par t.Position + Vector3.new(0, 800, 0)})

tween:Play()
tween.Completed:Wait()

It’s activated at some point ingame. The rest of the script works but the snippet doesn’t.

1 Like

What does tween.Completed:Wait() do?

It just waits after completing the tween once before doing it again according to the for loop, calms down exhaustion time

If I do that, the tweens won’t fire at the same time

Could you send a screenshot of everything in “RiseUp”?

1 Like

Got it
image

So I made the Code in studio and it worked fine, you can either check your Rising info if it’s incorrect or not but this is what I ran

for i, part in pairs(game.Workspace.Folder:GetDescendants()) do
	if part:IsA("BasePart") or part:IsA("MeshPart") then
		local tween = TS:Create(part, TweenInfo.new(55, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = part.Position + Vector3.new(0, 800, 0)})
		tween:Play()
	end
end

RisingInfo is TweenInfo.new(4, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)

We shall not speak of this post again
image

1 Like

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