Advertisement
IAmBW

birds

Mar 21st, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  2. part.Parent = parent
  3. part.formFactor = form
  4. part.CanCollide = collide
  5. part.Transparency = tran
  6. part.Reflectance = ref
  7. part.Size = Vector3.new(x,y,z)
  8. part.BrickColor = BrickColor.new(color)
  9. part.TopSurface = 0
  10. part.BottomSurface = 0
  11. part.Anchored = anchor
  12. part.Locked = true
  13. part:BreakJoints()
  14. end
  15.  
  16. function weld(w, p, p1, a, b, c, x, y, z)
  17. w.Parent = p
  18. w.Part0 = p
  19. w.Part1 = p1
  20. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  21. end
  22.  
  23. function bird(pos)
  24. local mod = Instance.new("Model")
  25. mod.Name = "Bird"
  26. local main = Instance.new("Part")
  27. prop(main,mod,true,0,0,1.5,1.4,2.5,"Black",false,"Custom")
  28. main.CFrame = CFrame.new(pos) * CFrame.Angles(0,math.random(-32,32)/10,0)
  29. main.Name = "Torso"
  30. Instance.new("SpecialMesh",main).MeshType = "Sphere"
  31.  
  32. local pa1 = Instance.new("Part")
  33. prop(pa1,mod,false,0,0,0.9,1,0.9,"Black",false,"Custom")
  34. pa1.CFrame = main.CFrame
  35. pa1.Name = "Head"
  36. Instance.new("SpecialMesh",pa1).MeshType = "Sphere"
  37.  
  38. local pa2 = Instance.new("Part")
  39. prop(pa2,mod,false,0,0,0.2,0.4,0.7,"Neon orange",false,"Custom")
  40. pa2.CFrame = main.CFrame
  41. Instance.new("SpecialMesh",pa2).MeshType = "Wedge"
  42.  
  43. local wing1 = Instance.new("Part")
  44. prop(wing1,mod,false,0,0,0.2,1.8,1.1,"Black",false,"Custom")
  45. wing1.CFrame = main.CFrame
  46.  
  47. local wing2 = Instance.new("Part")
  48. prop(wing2,mod,false,0,0,0.2,1.8,1.1,"Black",false,"Custom")
  49. wing2.CFrame = main.CFrame
  50.  
  51.  
  52. local w1 = Instance.new("Weld")
  53. weld(w1,main,pa1,0.5,0,0,0,-0.6,1.2)
  54. w1.Name = "Neck"
  55.  
  56. local w2 = Instance.new("Weld")
  57. weld(w2,main,pa2,-0.2,0,0,0,-0.6,1.7)
  58.  
  59. local wi1 = Instance.new("Weld")
  60. weld(wi1,main,wing1,0,0,math.pi/2,-1,-0.1,0.1)
  61. local worig1 = CFrame.new(0.4,0,0) * CFrame.fromEulerAnglesXYZ(0,0,-0.4)
  62. wi1.C0 = worig1
  63.  
  64. local wi2 = Instance.new("Weld")
  65. weld(wi2,main,wing2,0,0,-math.pi/2,1,-0.1,0.1)
  66. local worig2 = CFrame.new(-0.4,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0.4)
  67. wi2.C0 = worig2
  68.  
  69. local hum = Instance.new("Humanoid",mod)
  70. hum.Name = "Humanoid"
  71. hum.MaxHealth = 30
  72. hum.Health = 30
  73.  
  74. local bv = Instance.new("BodyVelocity",main)
  75. bv.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  76. bv.P = 5000
  77. bv.velocity = main.CFrame.lookVector * 6
  78.  
  79. local bav = Instance.new("BodyAngularVelocity",main)
  80. bav.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  81. bav.P = 5000
  82. bav.angularvelocity = Vector3.new(0,0,0)
  83.  
  84. hum.Died:connect(function()
  85. bv:remove()
  86. bav:remove()
  87. wait(4)
  88. mod:remove()
  89. end)
  90. mod.Parent = workspace
  91. mod:MakeJoints()
  92. coroutine.resume(coroutine.create(function()
  93. while true do
  94. for i=0.4,-0.4,-0.15 do
  95. wait()
  96. wi1.C0 = worig1 * CFrame.fromEulerAnglesXYZ(0,0,i)
  97. wi2.C0 = worig2 * CFrame.fromEulerAnglesXYZ(0,0,-i)
  98. end
  99. for i=0.4,-0.4,-0.15 do
  100. wait()
  101. wi1.C0 = worig1 * CFrame.fromEulerAnglesXYZ(0,0,-i)
  102. wi2.C0 = worig2 * CFrame.fromEulerAnglesXYZ(0,0,i)
  103. end
  104. end
  105. end))
  106. coroutine.resume(coroutine.create(function()
  107. while true do
  108. wait(0.1)
  109. local turn = math.random(1,6)
  110. coroutine.resume(coroutine.create(function()
  111. if turn == 1 then
  112. bav.angularvelocity = Vector3.new(0,6,0)
  113. wait(1)
  114. bav.angularvelocity = Vector3.new(0,0,0)
  115. bv.velocity = main.CFrame.lookVector * 6
  116. elseif turn == 2 then
  117. bav.angularvelocity = Vector3.new(0,-6,0)
  118. wait(1)
  119. bav.angularvelocity = Vector3.new(0,0,0)
  120. bv.velocity = main.CFrame.lookVector * 6
  121. end
  122. end))
  123. end
  124. end))
  125. end
  126.  
  127. for i=1, math.random(4,11) do
  128. local poz = Vector3.new(math.random(-100,100),math.random(60,80),math.random(-100,100))
  129. bird(poz)
  130. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement