Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

for i,v in pairs not changing the size of all parts?

for i, v in pairs(game.Workspace.Obby.Regular.Push:GetChildren()) do
	if v.Push then
		local part = v
		local value = v.Push.Value
		spawn(function()
			while wait() do
				wait(value)
				part.Decal.Texture = "rbxassetid://272632642"
				for i = 1,(part.Size.z / 0.30) do
					part.CFrame = part.CFrame + (part.CFrame.lookVector * -0.30)
					wait()
				end
				wait(value)
				part.Decal.Texture = "rbxassetid://334960362"
				for i = 1,(part.Size.z / 0.30) do
					part.CFrame = part.CFrame + (part.CFrame.lookVector * 0.30)
					wait()
				end
			end
		end)
	end
end

Making a script that increases the size of all the parts with a "Push" Value inside of them in a folder but only one part is actually increasing in size but the others aren't

How do I fix the problem?

3 comments

1

Your problem is being cause by the while loop. It was never built on a condition or told to break, therefore it won't. It'll simply just hang, and the for loop cannot iterate to the next part.

1

You can remove the loop entirely, or wrap it in a spawn function to start multiple threads

0

i haven't thought of that thanks

1 answer

✓ Accepted answer

maybe try:

if v:FindFirstChildOfClass("NumberValue") then

or

if v:FindFirstChild("Push") then

or maybe even this

if v:IsA("Part") and v:FindFirstChild("Push") then

one of these should probably work

2 comments

0

didnt work lol i just wanted to give you points

0

i already fixed it long before you asnwered

This discussion is preserved as it was. New answers, comments, and votes are closed.