Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Grid Service
- -- Quoteory
- -- August 4, 2019
- --[[
- Server:
- Client:
- --]]
- local GridService = {Client = {}}
- local Cube
- function GridService:GenerateGrid(Position, Size, GridSize)
- local centerPart = Instance.new("Part")
- centerPart.BrickColor = BrickColor.Red()
- centerPart.Size = Vector3.new(2, 10, 2)
- centerPart.Anchored = true
- centerPart.Position = Position
- centerPart.Parent = workspace
- local centerCFrame = centerPart.CFrame
- local SizeX = Size.X
- local Width = SizeX * GridSize
- for x = 1, GridSize do
- for z = 1, GridSize do
- local Offset = CFrame.new(-(Width/2)-SizeX/2, 0, -(Width/2)-SizeX/2)
- local CF = centerCFrame * CFrame.new(SizeX * x, 0, Size.Z * z) * Offset
- local cube = Cube.new(Size, CF.Position)
- end
- end
- print("Width = " .. Width)
- end
- function GridService:Start()
- GridService:GenerateGrid(Vector3.new(0, 15, 0), Vector3.new(4, 4, 4), 12)
- end
- function GridService:Init()
- Cube = self.Modules.Cube
- end
- return GridService
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement