Script is not even doing anything?

hello i have a script it is supposed to make anything under workspace.Objects wave but it is not working, if anyone could help, it would be awesome.

local Descendants = workspace.Objects:GetDescendants()

while true do
    for _, object in ipairs(Descendants) do
        if object.Name == "leaf" then
            pos = object.Position
            pos =, pos.y-0.2, pos.z)
            x = 0
            z = 0
            T = -99999
            tall = object.Size.Y / 2
            rand = (math.random(0,20))/10
            x = pos.x + (math.sin(T + (pos.x/5)) * math.sin(T/9))/3
            z = pos.z + (math.sin(T + (pos.z/6)) * math.sin(T/12))/4
            object.CFrame =, pos.y, z) * CFrame.Angles((z-pos.z)/tall, 0,(x-pos.x)/-tall)
            T = T + 0.12
1 Like

I know this is a stupid question, I am not an advanced roblox scripter but did set the objects name to leaf? I have two more questions:

  1. Where did you put the script?

  2. If there are any errors, can you tell me what they were?

The objects are called leaf, the script is in ServerScriptService, and there are no errors.

I am really sorry but I can’t help you. I’m currently in a process in learning advanced scripting. I hope it’s okay. Im really sorry.

Try changing




the leaves are inside the models inside objects.

1 Like

Are they named leaf? Or Leaf? If they are named leaf and not with a Capital L then do a print after the if object.Name and a print of

they are called “leaf” all of them

Is this a local script or script? If it’s a local script where is it parented to? If it’s a script, then add a print before your loop and check if that prints

I think you need to put local at the start of all of your variables to declare them.

i fixed it by putting descendants into the loop