Advertisement
Upscalefanatic3

Grid

Oct 3rd, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. -- [[ Grids are cool ]] --
  2.  
  3.  
  4. Grid = {}
  5. Grid.Admins = {"Upscalegaming", "InfernoGun"}
  6. Grid.BrickColor = BrickColor.new("Dark green")
  7. Grid.Transparency = 0
  8. Grid.Position = Vector3.new(0, 2, 0)
  9. Grid.Model = nil
  10. Grid.Debounce = false
  11.  
  12.  
  13. Make = function(SizeX, SizeY)
  14. pcall(function() Grid.Model:Remove() end)
  15. Grid.Model = Instance.new("Model", Workspace)
  16. Grid.Model.Name = "Grid"
  17. for x = 1, SizeX do
  18. for z = 1, SizeY do
  19. local GridPart = Instance.new("Part", Grid.Model)
  20. GridPart.Name = "GridPart " ..x.. " " ..z
  21. GridPart.BottomSurface = 0
  22. GridPart.BrickColor = Grid.BrickColor
  23. GridPart.Transparency = Grid.Transparency
  24. GridPart.Anchored = true
  25. GridPart.FormFactor = "Custom"
  26. GridPart.Size = Vector3.new(4, 1, 4)
  27. GridPart.CFrame = CFrame.new(Grid.Position.x + (x * 4), Grid.Position.y, Grid.Position.z + (z * 4))
  28. local SelectionBox = Instance.new("SelectionBox", GridPart)
  29. SelectionBox.Name = "SelectionBox"
  30. SelectionBox.Adornee = GridPart
  31. SelectionBox.Color = Grid.BrickColor
  32. SelectionBox.Transparency = Grid.Transparency
  33. end
  34. wait()
  35. end
  36. end
  37.  
  38.  
  39. Explode = function(Divider, Text)
  40. if Text == "" or type(Text) ~= "string" then return {""} end
  41. if Divider == "" or type(Divider) ~= "string" then return {Text} end
  42. local Position, Words = 0, {}
  43. for Start, Stop in function() return string.find(Text, Divider, Position, true) end do
  44. table.insert(Words, string.sub(Text, Position, Start - 1))
  45. Position = Stop + 1
  46. end
  47. table.insert(Words, string.sub(Text, Position))
  48. return Words
  49. end
  50.  
  51.  
  52. function ChatterBox(Msg)
  53. if Grid.Debounce == true then return end
  54. Grid.Debounce = true
  55. if string.sub(Msg, 0, 4) == "/in/" then
  56. for _, Player in pairs(game:GetService("Players"):GetPlayers()) do
  57. if string.match(Player.Name:lower(), string.sub(Msg, 5)) then
  58. pcall(function() Player.Character.Torso.CFrame = CFrame.new(Grid.Position + Vector3.new(4, 6, 4)) end)
  59. wait(0.5)
  60. end
  61. end
  62. elseif string.sub(Msg, 1, 6) == "/make/" then
  63. local Size = Explode("/", string.sub(Msg, 7))
  64. local X, Z = tonumber(Size[1]), tonumber(Size[2])
  65. if X ~= nil and Z ~= nil then
  66. Make(tonumber(Size[1]), tonumber(Size[2]))
  67. end
  68. elseif string.sub(Msg, 0, 1) == "/" and Grid.Model ~= nil then
  69. for x, Part in pairs(Grid.Model:GetChildren()) do
  70. local OldTransparency = Part.Transparency
  71. coroutine.wrap(function()
  72. for i = 0, 1, 0.05 do
  73. Part.CFrame = CFrame.new(Part.CFrame.p) * CFrame.fromEulerAnglesXYZ(0, math.rad(math.cos(i * (math.pi / 2)) * 180), 0)
  74. Part.Transparency = OldTransparency + ((1 - OldTransparency) * i)
  75. Part.SelectionBox.Transparency = OldTransparency + ((1 - OldTransparency) * i)
  76. wait()
  77. end
  78. Part.Transparency = 1
  79. Part.SelectionBox.Transparency = 1
  80. wait(0.5)
  81. if string.sub(Msg, 1, 7) == "/color/" then
  82. Grid.BrickColor = BrickColor.new(tostring(tonumber(string.sub(Msg, 8))) == string.sub(Msg, 8) and tonumber(string.sub(Msg, 8)) or string.sub(Msg, 8))
  83. Part.BrickColor = Grid.BrickColor
  84. Part.SelectionBox.Color = Grid.BrickColor
  85. elseif string.sub(Msg, 1, 14) == "/transparency/" then
  86. Grid.Transparency = tonumber(string.sub(Msg, 15)) or 0
  87. elseif string.sub(Msg, 1, 6) == "/move/" then
  88. local Position = Explode("/", string.sub(Msg, 7))
  89. local X, Y, Z = tonumber(Position[1]), tonumber(Position[2]), tonumber(Position[3])
  90. if X ~= nil and Y ~= nil and Z ~= nil then
  91. Grid.Position = Vector3.new(X, Y, Z)
  92. local Offset = Explode(" ", Part.Name)
  93. Part.CFrame = CFrame.new(Grid.Position.x + (tonumber(Offset[2]) * 4), Grid.Position.y, Grid.Position.z + (tonumber(Offset[3]) * 4))
  94. end
  95. end
  96. for i = 1, 0, -0.05 do
  97. Part.CFrame = CFrame.new(Part.CFrame.p) * CFrame.fromEulerAnglesXYZ(0, math.rad(math.cos(i * (math.pi / 2)) * -180), 0)
  98. Part.Transparency = Grid.Transparency + ((1 - Grid.Transparency) * i)
  99. Part.SelectionBox.Transparency = OldTransparency + ((1 - OldTransparency) * i)
  100. wait()
  101. end
  102. Part.CFrame = CFrame.new(Part.CFrame.p)
  103. Part.Transparency = Grid.Transparency
  104. end)()
  105. wait()
  106. end
  107. end
  108. wait(0.1)
  109. Grid.Debounce = false
  110. end
  111.  
  112.  
  113. for _, Player in pairs(game:GetService("Players"):GetPlayers()) do
  114. for i = 1, #Grid.Admins do
  115. if Player.Name == Grid.Admins[i] then
  116. Player.Chatted:connect(ChatterBox)
  117. end
  118. end
  119. end
  120.  
  121.  
  122. Make(10, 10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement