nikimario99

Black White Game Script

Oct 3rd, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. dist = 5
  2. function get(pa,mo)
  3. local ps = {}
  4. for _,v in pairs(mo:children()) do
  5. if (v.Position - pa.Position).magnitude < dist then
  6. table.insert(ps,v)
  7. end
  8. end
  9. return ps
  10. end
  11. for o=-60,60,30 do
  12. for i=-60,60,30 do
  13. local x = 0
  14. local z = 0
  15. local max = 20
  16. local modul = Instance.new("Model",workspace)
  17. repeat
  18. local p = Instance.new("Part",modul)
  19. p.Size = Vector3.new(4,1,4)
  20. p.TopSurface = 0
  21. p.Anchored = true
  22. p.BrickColor = BrickColor.new("Black")
  23. p.CFrame = CFrame.new(x+i,3,z+o)
  24. local klik = Instance.new("ClickDetector",p)
  25. klik.MouseClick:connect(function()
  26. local parts = get(p,modul)
  27. for _,v in pairs(parts) do
  28. if v.BrickColor.Name == "Black" then
  29. v.BrickColor = BrickColor.new("White")
  30. else
  31. v.BrickColor = BrickColor.new("Black")
  32. end
  33. end
  34. local nu = #modul:children()
  35. local n = 0
  36. for _,v in pairs(modul:children()) do
  37. if v.BrickColor.Name == "White" then
  38. n = n + 1
  39. end
  40. end
  41. if n >= nu then
  42. modul:remove()
  43. end
  44. end)
  45. x = x + p.Size.X
  46. if x >= max then
  47. x = 0
  48. z = z + p.Size.Z
  49. end
  50. until z >= max
  51. end
  52. end
Add Comment
Please, Sign In to add comment