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

Whats wrong with my script? Any alternate instead of using while true do

Asked by 6 years ago

local trees = {"OakTree1","OakTree2","OakTree3","OakTree4","OakTree5","OakTree6","OakTree7","PineTree1","PineTree2"}

for i,a in pairs(trees) do for i,b in pairs(workspace:GetChildren()) do if b.Name == a then

        local position = b.Leaves.Position
        local pos = Vector3.new(position.x, position.y - 0.2, position.z)
        local c = -99999
        local height = b.Leaves.Size.Y / 2

        math.randomseed(tick())
        rand = (math.random(0,20))/10
        while true do
            x = pos.x + (math.sin(c + (pos.x/5)) * math.sin(c/9))/3
            z = pos.z + (math.sin(c + (pos.z/6)) * math.sin(c/12))/4
            b.Leaves.CFrame = CFrame.new(x, pos.y, z) * CFrame.Angles((z-pos.z)/height, 0,(x-pos.x)/-height)
            wait()
            c = c + 0.12

        end            
    end
end

end

-- colorful_parrots#0335 is my discord, best way to contact me.

0
You could use the runservice.stepped event Wafflecow321 457 — 6y
0
What are you trying to do? NotInventedHere 158 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Code blocks ??

Ad

Answer this question