Advertisement
Guest User

"FallingBlocks.rbxl"

a guest
Sep 21st, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. wait(1)
  2. local Bottom = 8
  3. local Top = 68
  4. local Base = 4
  5. local ExtentNeg = -16
  6. local ExtentPos = 16
  7. local Model = Instance.new("Model",game.Workspace)
  8. local Part = Instance.new("Part")
  9. Part.FormFactor = "Symmetric"
  10. Part.Anchored = true
  11. Part.TopSurface = "Smooth"
  12. Part.BottomSurface = "Smooth"
  13. Part.Size = Vector3.new(Base,Base,Base)
  14. local X = {}
  15. for i = ExtentNeg, ExtentPos, Base do
  16.     X[i] = Bottom
  17. end
  18. while true do
  19.     local gameover = false
  20.     for i, v in pairs(X) do
  21.         if v == Top - Base then
  22.             gameover = true
  23.         end
  24.     end
  25.     if gameover == false then
  26.         local NewPart = Part:clone()
  27.         NewPart.Parent = Model
  28.         NewPart.BrickColor = BrickColor.Random()
  29.         local NewX = math.random(ExtentNeg + Base, ExtentPos - Base)
  30.         local Y = Top
  31.         repeat NewX = NewX + 1 until NewX % Base == 0
  32.         NewPart.CFrame = CFrame.new(NewX,Y,0)
  33.         repeat
  34.             wait(1/10)
  35.             NewPart.CFrame = NewPart.CFrame - Vector3.new(0,Base,0)
  36.             Y = Y - Base
  37.         until
  38.             Y == X[NewX] + Base
  39.         X[NewX] = Y
  40.     else
  41.         local hint = Instance.new("Message",game.Workspace)
  42.         hint.Text = "Game over!"
  43.         wait(5)
  44.         hint:Destroy()
  45.         Model:ClearAllChildren()
  46.         for i = ExtentNeg, ExtentPos, 4 do
  47.             X[i] = Bottom
  48.         end
  49.     end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement