Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago
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?

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. Ziffixture 6913 — 4y
1
You can remove the loop entirely, or wrap it in a spawn function to start multiple threads Ziffixture 6913 — 4y
0
i haven't thought of that thanks Bloxulen 88 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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

0
didnt work lol i just wanted to give you points Bloxulen 88 — 4y
0
i already fixed it long before you asnwered Bloxulen 88 — 4y
Ad

Answer this question