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

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

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.

2 comments

0

You could use the runservice.stepped event

0

What are you trying to do?

1 answer

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