Advertisement
vlustrousv

Wind Movement for Trees [Script]

Mar 26th, 2023
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | Source Code | 0 0
  1. -- If you have a tree in Roblox Studio, Keep this sccript inside of the leaves.
  2. -- This script makes the leaves move slightly.
  3.  
  4. pos = script.Parent.Position
  5. pos = Vector3.new(pos.x, pos.y-0.2, pos.z)
  6. x = 0
  7. z = 0
  8. T = -99999
  9. tall = script.Parent.Size.Y / 2
  10. math.randomseed(tick())
  11. rand = (math.random(0,20))/10
  12. while true do
  13.     x = pos.x + (math.sin(T + (pos.x/5)) * math.sin(T/9))/3
  14.     z = pos.z + (math.sin(T + (pos.z/6)) * math.sin(T/12))/4
  15.     script.Parent.CFrame =
  16.         CFrame.new(x, pos.y, z) * CFrame.Angles((z-pos.z)/tall, 0,(x-pos.x)/-tall)
  17.     wait()
  18.     T = T + 0.12
  19. end
  20.  
  21. -- by @vlustrousv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement