Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function createTile(vec3, n1, n2, parent)
- local newTile = script:WaitForChild("Tile"):Clone()
- newTile.Position = vec3
- local nameTS = "Tile"..n1..n2
- newTile.Name = nameTS
- newTile.Highlight.Visible = true
- newTile.Parent = parent
- local tween = tweenService:Create(newTile, gridInfo, {Size = Vector3.new(gS,0.05,gS)})
- tween:Play()
- tiles[#tiles+1] = newTile
- end
- local function createGrid(floor, grid)
- local xs = floor.Size.X
- local zs = floor.Size.Z
- local xp = floor.Position.X
- local zp = floor.Position.Z
- local yp = floor.Position.Y
- local gridSize
- if not grid then
- gridSize = 3
- else
- gridSize = grid
- end
- local xVals = {}
- local zVals = {}
- for zVec = zs, gridSize, -gridSize do
- zVals[#zVals+1] = zVec
- end
- for xVec = xs, gridSize, -gridSize do
- xVals[#xVals+1] = xVec
- end
- for n,xv in pairs(xVals) do
- for i,zv in pairs(zVals) do
- local newVec = Vector3.new((xp - (xs / 2)) + xv - (gridSize / 2), (yp * 2) + 0.05, (zp - (zs / 2)) + zv - (gridSize / 2))
- createTile(newVec, n, i, floor)
- end
- end
- end
- local function removeGrid()
- for num = 1,#tiles do
- coroutine.wrap(function()
- local tween = tweenService:Create(tiles[num],tweenInfo,{Size = Vector3.new(0.05,0.05,0.05)})
- tween:Play()
- tween.Completed:Wait()
- tiles[num]:Destroy()
- tiles[num]=nil
- end)()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement