Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local costSpine = 1 -- Customize the cost here
- local itemNeeded = "block_hunt_coin" -- Customize the required item here
- local commonList = {
- {"stopwatch", 1},
- {"duck_spawn_egg", 5},
- {"treasure_chest", 5},
- {"stopwatch", 5},
- {"emerald_dao", 1},
- {"grappling_hook", 1},
- {"pie", 5},
- {"balloon", 50},
- {"swap_ball", 5},
- {"speed_boots", 1},
- {"stopwatch", 5},
- {"headhunter", 1},
- {"firework_arrow", 350}
- }
- local commonParticleId = "rbxassetid://12605639346"
- local rareList = {
- {"double_rainbow_boots", 1},
- {"mythic_great_hammer", 1},
- {"heal_banner", 25},
- {"spider_web", 10},
- {"telepearl", 2},
- {"crit_star", 35},
- {"spirit_bridge", 10},
- {"teleport_hat", 1},
- {"rainbow_backpack", 1},
- {"flying_backpack", 1},
- {"bacon_blade", 1},
- {"chicken_deploy", 10},
- {"block_hunt_coin", 5},
- {"beehive_grenade", 10}
- }
- local rareParticleId = "rbxassetid://10653373712"
- local function giveSpecificItem(player, itemName, quantity)
- InventoryService.giveItem(player, itemName, quantity, true)
- end
- local function rotateAndDestroyFinalItem(finalItemTypeModel, player, finalItem, finalAmount, copperPosition, createPrompt)
- local finalItemPosition = finalItemTypeModel:getPosition()
- local cloudSpawnPosition = finalItemPosition - Vector3.new(0, 3, 0)
- local cloudColor = Color3.new(0.8, 0.8, 0.8)
- local cloudParticles = ParticleService.createParticleEmitter(cloudSpawnPosition, Vector3.new(2, 23.5, 0))
- -- Set particle texture based on item list
- local particleId = commonParticleId
- for _, item in pairs(commonList) do
- if item[1] == finalItem then
- particleId = commonParticleId
- break
- end
- end
- for _, item in pairs(rareList) do
- if item[1] == finalItem then
- particleId = rareParticleId
- break
- end
- end
- cloudParticles:setTexture(particleId)
- cloudParticles:setRotation(Vector3.new(1, 0, 0))
- cloudParticles:setRate(50)
- cloudParticles:setLifetime(NumberRange.new(30, 40))
- cloudParticles:setSpeed(NumberRange.new(5, 9))
- cloudParticles:setDrag(0.2)
- cloudParticles:setBrightness(20)
- cloudParticles:setParticleOrientation(ParticleOrientation.VelocityParallel)
- cloudParticles:setSpreadAngle(Vector2.new(-40, 40))
- cloudParticles:setRotSpeed(NumberRange.new(9, 11))
- local cloudColorSequence = ColorSequence.new(cloudColor)
- cloudParticles:setColor(cloudColorSequence)
- SoundService.playSound(SoundType.VENDING_ROLL_PRIZE, cloudSpawnPosition)
- createPrompt(copperPosition)
- for i = 1, 100 do
- finalItemTypeModel:setRotation(Vector3.new(0, 40, 0))
- wait(0.001)
- end
- cloudParticles:destroy()
- finalItemTypeModel:destroy()
- createPrompt(copperPosition)
- MessageService.sendInfo(player, "You received: " .. finalAmount .. "x " .. string.upper(finalItem) .. "!")
- end
- local function createPrompt(copperPosition)
- local promptCopper = PromptService.createPrompt()
- promptCopper:setHoldDuration(3.5)
- promptCopper:setActivationDistance(10)
- promptCopper:setPosition(copperPosition)
- promptCopper:setObjectText("buy a spin for 1 coin you can get the coin from asking the cohost/owner or you can get it from the shop !")
- promptCopper:setActionText("1 coin for 1 spin")
- promptCopper:onActivated(function(player)
- if player then
- if InventoryService.getAmount(player, itemNeeded) >= costSpine then
- promptCopper:destroy() -- Destroy the prompt only if the player has the required amount
- local startTime = tick()
- -- Remove the required item from the player's inventory after prompt destruction
- local removedAmount = InventoryService.removeItemAmount(player, itemNeeded, costSpine)
- while tick() - startTime < 10 do
- local randomList
- local particleId
- if math.random() < 0.5 then
- randomList = commonList
- particleId = commonParticleId
- else
- randomList = rareList
- particleId = rareParticleId
- end
- local randomReward = randomList[math.random(#randomList)]
- local randomItem = randomReward[1]
- local itemTypeModel = ModelService.createItemModel(randomItem, copperPosition + Vector3.new(0, 6, 0))
- itemTypeModel:setScale(1.5)
- itemTypeModel:setAnchored(true)
- itemTypeModel:setCollidable(false)
- giveSpecificItem(player, randomItem, 0)
- wait(0.2)
- itemTypeModel:destroy()
- SoundService.playSound(SoundType.STOPWATCH_ACTIVATED, copperPosition)
- end
- wait(1)
- local finalList
- local finalParticleId
- if math.random() < 0.5 then
- finalList = commonList
- finalParticleId = commonParticleId
- else
- finalList = rareList
- finalParticleId = rareParticleId
- end
- local finalReward = finalList[math.random(#finalList)]
- local finalItem = finalReward[1]
- local finalAmount = finalReward[2]
- local finalItemTypeModel = ModelService.createItemModel(finalItem, copperPosition + Vector3.new(0, 9., 0))
- finalItemTypeModel:setScale(4.8)
- finalItemTypeModel:setAnchored(true)
- finalItemTypeModel:setCollidable(false)
- giveSpecificItem(player, finalItem, finalAmount)
- SoundService.playSound(SoundType.FIREWORK_EXPLODE_2, copperPosition)
- rotateAndDestroyFinalItem(finalItemTypeModel, player, finalItem, finalAmount, copperPosition, createPrompt)
- else
- MessageService.sendInfo(player, "Insufficient " .. string.upper(itemNeeded) .. ". You need at least " .. costSpine .. " " .. string.upper(itemNeeded) .. " to proceed.")
- end
- end
- end)
- end
- Events.BlockPlace(function(event)
- if (event.blockType == ItemType.COPPER_BLOCK) then
- local copperPosition = event.position
- createPrompt(copperPosition)
- end
- end)
Advertisement
Comments
-
- This script has it own common and rare lost meaning what every time it lands on it dose a different image id that you can set it to
Add Comment
Please, Sign In to add comment
Advertisement