Advertisement
DatKirby101

Vulcan's Grasp Script

Jun 23rd, 2018
822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.29 KB | None | 0 0
  1. local Tycoon = script.Parent.Parent.Parent.Parent
  2.  
  3. local basemulti = 0
  4. local function value(Item)
  5. -----^^^Not fully finished^^^---
  6. local multi = 1
  7.  
  8. if Item:FindFirstChild("Model") and Item:FindFirstChild("Tier") then    --If the item has a model and a tier in it then...
  9.     if Item.Model:FindFirstChild("Upgrade") then    --If the item has an upgrader part in it then...
  10.         multi = 6   --Change the multiplier to 6
  11.     elseif Item.Model:FindFirstChild("Drop") or Item.Model:FindFirstChild("Conv") then --If the item has a conveyor or dropper then
  12.         multi = 2   --Change the multiplier to 2
  13.     end
  14.     if Item.Tier.Value == 30 then --Reborn--
  15.         return 0.04 * multi
  16.     elseif Item.Tier.Value == 31 then   --Reborn Fusion
  17.         return 0.06 * multi
  18.     elseif Item.Tier.Value == 32 then   --Evolved Reborn
  19.         return 0.1 * multi
  20.     elseif Item.Tier.Value == 33 then   --Advanced Reborn
  21.         return 0.07 * multi
  22.     elseif Item.Tier.Value > 5 then     --Other stuff with a tier greater than 5
  23.         return 0.03 * multi
  24.     else                                --Everything else
  25.         return 0.005 * multi
  26.     end
  27.     return 0
  28.     end
  29. end
  30. --\/ Item handler \/--
  31. for i,Item in pairs(Tycoon:GetChildren()) do   
  32.     basemulti = basemulti + value(Item)
  33. end
  34.  
  35. Tycoon.ChildAdded:Connect(function(Item)
  36.     basemulti = basemulti + value(Item)
  37. end)
  38.  
  39. Tycoon.ChildRemoved:Connect(function(Item)
  40.     basemulti = basemulti - value(Item)
  41. end)
  42. --/\ Item handler /\--
  43. script.Parent.Upgrade.Touched:connect(function(hit)
  44.     if hit:FindFirstChild("Cash") then
  45.         if not game.CollectionService:HasTag(hit, "Vulcan") then
  46.            
  47.             game.CollectionService:AddTag(hit, "Vulcan")
  48.            
  49.             local tagmulti = #hit:GetChildren()/30  --All the upgrades that are done to the ore divided by 30
  50.             if tagmulti >= 7 then   --If the tag multiplier is > 7, then make it 7
  51.                 tagmulti = 7
  52.             end
  53.             local Multi = basemulti
  54.             if Multi >= 50 then     --If the multiplier of the items on your base > 50, then make it 50
  55.                 Multi = 50
  56.             end
  57.             Multi = 1 + (Multi * tagmulti) --Add/multiply everything up, cap of x351!
  58.            
  59.             hit.Cash.Value = math.ceil(hit.Cash.Value * Multi)  --Multiplies the ore by the total multiplier
  60.             hit.Reflectance = hit.Reflectance + 0.1
  61.         else
  62.             script.Parent.Upgrade.BrickColor = BrickColor.new("Black")
  63.             wait(0.1)
  64.             script.Parent.Upgrade.BrickColor = BrickColor.new("Institutional white")
  65.         end
  66.     end
  67. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement