Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The parameters for frosty waves
- local initialBatchSize = 10
- local batchSize = initialBatchSize
- local speed = 30
- local attackDistance = 25
- local damageAmount = 15
- local customMaxHealth = 100
- local customHandItem = ItemType.SKY_SCYTHE
- local customKitType = KitType.FROSTY
- local damageMultiplier = 5
- local waitBeforeStartEachWave = 10 -- Adjust this value for the desired wait time per wave
- local additionalFrostiesPerWave = 3 -- Adjust this value for the number of additional Frosties per wave
- local hitSound = SoundType.PENGUIN_ATTACK_3
- local spawnSound = SoundType.WIZARD_LIGHTNING_CAST
- local function waitBeforeNextWave(seconds)
- local remainingTime = seconds
- while remainingTime > 0 do
- AnnouncementService.sendAnnouncement("Next wave in " .. math.floor(remainingTime) .. " seconds.", Color3.fromRGB(0, 128, 255))
- remainingTime = remainingTime - 1
- task.wait(1)
- end
- end
- local function addMorePerWave()
- batchSize = batchSize + additionalFrostiesPerWave
- end
- local function spawnFrosties()
- local currentWave = 1
- while true do
- -- Get all grass blocks
- local grassBlocks = BlockService.getAboveRandomBlock({"grass"})
- if not grassBlocks then
- error("No grass block found!")
- end
- local basePosition = Vector3.new(grassBlocks.X, grassBlocks.Y + 5, grassBlocks.Z)
- local frostiesAlive = 0
- local isWaveAnnounced = false
- local isTimerAnnounced = false
- for i = 1, batchSize do
- local offset = Vector3.new(math.random(-5, 5), 0, math.random(-5, 5))
- local position = basePosition + offset
- local frosty = EntityService.spawnKitEntity(customKitType, position)
- frosty:setMaxHealth(customMaxHealth)
- frosty:setHandItem(customHandItem)
- frosty:setSpeed(speed)
- task.spawn(function()
- while frosty:isAlive() do
- local players = PlayerService.getPlayers()
- if #players > 0 then
- local randomPlayer = players[math.random(#players)]
- if randomPlayer then
- local playerPos = randomPlayer:getEntity():getPosition()
- frosty:setPosition(playerPos)
- frosty:moveTo(playerPos)
- local frostyPos = frosty:getPosition()
- local distance = (playerPos - frostyPos).Magnitude
- if distance <= attackDistance then
- CombatService.damage(randomPlayer:getEntity(), damageAmount, {
- horizontal = 0,
- vertical = 0,
- fromPosition = playerPos
- })
- task.wait(0.0000001)
- end
- end
- end
- task.wait(1)
- end
- frostiesAlive = frostiesAlive - 1
- end)
- frostiesAlive = frostiesAlive + 1
- end
- if not isWaveAnnounced then
- AnnouncementService.sendAnnouncement("Round " .. currentWave .. " has begun!", Color3.fromRGB(0, 128, 255))
- isWaveAnnounced = true
- end
- if currentWave > 1 then
- if not isTimerAnnounced then
- while frostiesAlive > 3 do
- task.wait(1)
- end
- AnnouncementService.sendAnnouncement("Next wave in " .. waitBeforeStartEachWave .. " seconds.", Color3.fromRGB(0, 128, 255))
- task.wait(waitBeforeStartEachWave)
- isTimerAnnounced = true
- end
- end
- currentWave = currentWave + 1
- end
- end
- -- Start spawning frosties immediately
- spawnFrosties()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement