Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local playerFirstBlockPosition = {}
- local playerCircleParts = {}
- local function createCircleParts(centerPosition, circleRadius)
- local partCount = 8 + (circleRadius * 2)
- local partSize = Vector3.new(1, 0.2, 0.3)
- local spaceGap = 0.5
- local parts = {}
- for i = 1, partCount do
- local angle = (i / partCount) * math.pi * 2
- local offsetX = math.cos(angle) * (circleRadius + partSize.X / 2 + spaceGap)
- local offsetZ = math.sin(angle) * (circleRadius + partSize.X / 2 + spaceGap)
- local partPosition = centerPosition + Vector3.new(offsetX, 0, offsetZ)
- local part = PartService.createPart(ItemType.WOOL_WHITE, partPosition)
- part:setSize(partSize)
- part:setAnchored(true)
- part:setCollidable(false)
- local lookAtCFrame = CFrame.new(partPosition, centerPosition)
- part:setCFrame(lookAtCFrame)
- table.insert(parts, part)
- end
- return parts
- end
- local function updateCirclePosition(parts, newCenterPosition, circleRadius)
- local partCount = #parts
- local partSize = Vector3.new(1, 0.2, 0.3)
- local spaceGap = 0.5
- for i = 1, partCount do
- local angle = (i / partCount) * math.pi * 2
- local offsetX = math.cos(angle) * (circleRadius + partSize.X / 2 + spaceGap)
- local offsetZ = math.sin(angle) * (circleRadius + partSize.X / 2 + spaceGap)
- local partPosition = newCenterPosition + Vector3.new(offsetX, 0, offsetZ)
- parts[i]:setPosition(partPosition)
- local lookAtCFrame = CFrame.new(partPosition, newCenterPosition)
- parts[i]:setCFrame(lookAtCFrame)
- end
- end
- local function updateCircleAroundFirstBlock(player)
- local entity = player:getEntity()
- if not entity then
- return
- end
- local position = entity:getPosition()
- local yPosition = position.Y
- local centerPosition = position + Vector3.new(0, -10, 0)
- local reachedBottom = false
- while true do
- yPosition = yPosition - 1
- local checkPosition = Vector3.new(position.X, yPosition, position.Z)
- local blockBeneath = BlockService.getBlockAt(checkPosition)
- if blockBeneath then
- local previousBlockPosition = playerFirstBlockPosition[player.userId]
- if previousBlockPosition ~= checkPosition then
- centerPosition = checkPosition + Vector3.new(0, 1.6, 0)
- local circleRadius = 13
- if not playerCircleParts[player.userId] then
- playerCircleParts[player.userId] = createCircleParts(centerPosition, circleRadius)
- else
- updateCirclePosition(playerCircleParts[player.userId], centerPosition, circleRadius)
- end
- playerFirstBlockPosition[player.userId] = checkPosition
- end
- break
- end
- if yPosition <= position.Y - 500 then
- reachedBottom = true
- break
- end
- end
- if reachedBottom then
- centerPosition = position + Vector3.new(0, -10, 0)
- if playerCircleParts[player.userId] then
- updateCirclePosition(playerCircleParts[player.userId], centerPosition, 13)
- end
- end
- end
- while true do
- for _, player in pairs(PlayerService.getPlayers()) do
- updateCircleAroundFirstBlock(player)
- end
- task.wait(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement