Advertisement
Guest User

Untitled

a guest
May 26th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. while true do
  2. for k, v in pairs(playerBlock) do
  3.  
  4. local player = k
  5.  
  6. local part = playerBlock[k]
  7.  
  8. if part ~= nil and part.Parent ~= nil then
  9. local playerData = dataManager.playerData(k)
  10.  
  11. local shrinkRay = enums.ShrinkRays[playerData.Stats["SHRINKRAY"]]
  12.  
  13. local model = part.Parent
  14.  
  15. if model:FindFirstChild("CurrentAmount") then
  16.  
  17. local petAddition = 0
  18.  
  19. for k, v in pairs(playerData.Pets) do
  20. if v.Equipped == true then
  21. petAddition = petAddition + enums.Pets[v.Pet].InitialAmount
  22. end
  23. end
  24.  
  25. local currentAmount = model.CurrentAmount.Value
  26. local maxAmount = model.MaxAmount.Value
  27.  
  28. local oldAmount = currentAmount
  29.  
  30. currentAmount = currentAmount-((waitTime*(shrinkRay.Amount+petAddition))/shrinkRay.Time)
  31.  
  32. model[player.Name].Value = model[player.Name].Value + ((waitTime*(shrinkRay.Amount+petAddition))/shrinkRay.Time)
  33.  
  34. model.CurrentAmount.Value = currentAmount
  35.  
  36. local ratio = (currentAmount/maxAmount)
  37.  
  38. local subtract = model.Subtract.Value
  39.  
  40. model.CurrentAmountDisplay.Value = currentAmount-subtract
  41. model.MaxAmountDisplay.Value = maxAmount-subtract
  42.  
  43. local spawning = workspace.Sectors[part.Parent.Name].PrimaryPart
  44. local yPlatform = spawning.Position.Y+(spawning.Size.Y/2)
  45.  
  46.  
  47. if model.CurrentAmountDisplay.Value > 0 then
  48.  
  49. model:SetPrimaryPartCFrame(CFrame.new(Vector3.new(part.Position.X, yPlatform+(model:GetExtentsSize().Y/2), part.Position.Z)))
  50.  
  51.  
  52. local nextOne = currentAmount / oldAmount
  53.  
  54. ScaleModel(model, nextOne)
  55.  
  56.  
  57. else
  58.  
  59.  
  60. playerData.Backpack.OBJECTS = playerData.Backpack.OBJECTS + backpackAmount
  61.  
  62. local maxAmount = enums.Backpacks[playerData.Stats.BACKPACK].Size
  63.  
  64. if playerData.Backpack.OBJECTS > maxAmount then
  65. playerData.Backpack.OBJECTS = maxAmount
  66. end
  67.  
  68.  
  69. model:Destroy()
  70. end
  71. end
  72. end
  73. end
  74. wait(waitTime)
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement