Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local teamDoorPosition = Vector3.new(321, 66, 339)
- local blockSize = Vector3.new(3, 3, 3)
- local gap = 3
- local xSideBlocks = 0
- local zSideBlocks = 2
- local blocksTall = 5
- local checkCooldown = -9999999
- local findRadius = 5
- local enableTeam = "Blue"
- local offsetsX = {0}
- local offsetsZ = {0}
- for i = 1, xSideBlocks do
- table.insert(offsetsX, -i * gap)
- table.insert(offsetsX, i * gap)
- end
- for j = 1, zSideBlocks do
- table.insert(offsetsZ, -j * gap)
- table.insert(offsetsZ, j * gap)
- end
- local function createPart(position, collidable)
- local partType = ItemType["WOOL_" .. enableTeam:upper()]
- local part = PartService.createPart(partType, position)
- part:setSize(blockSize)
- part:setAnchored(true)
- part:setCollidable(collidable)
- part:setTransparency(0.8)
- local currentCollidable = collidable
- task.spawn(function()
- while true do
- task.wait(checkCooldown)
- local nearbyEntities = EntityService.getNearbyEntities(part:getPosition(), findRadius)
- local foundNotBlue = false
- local foundTeam = false
- if nearbyEntities then
- for _, entity in ipairs(nearbyEntities) do
- if entity:isAlive() then
- local player = entity:getPlayer()
- if player then
- local team = TeamService.getTeam(player)
- if team.name ~= enableTeam then
- foundNotBlue = true
- local knockback = {
- fromPosition = part:getPosition(),
- horizontal = 0.4,
- vertical = 0.4
- }
- CombatService.damage(entity, 0, nil, knockback)
- else
- foundTeam = true
- end
- end
- end
- end
- end
- if foundNotBlue and not currentCollidable then
- part:destroy()
- createPart(part:getPosition(), true)
- break
- elseif foundTeam and currentCollidable then
- part:destroy()
- createPart(part:getPosition(), false)
- break
- end
- end
- end)
- return part
- end
- local parts = {}
- for layer = 0, blocksTall - 1 do
- local yOffset = layer * gap
- for i = 1, #offsetsX do
- for j = 1, #offsetsZ do
- local positionX = teamDoorPosition + Vector3.new(offsetsX[i], yOffset, offsetsZ[j])
- table.insert(parts, createPart(positionX, false))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement