RazBerry916

Untitled

Sep 14th, 2025
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.72 KB | None | 0 0
  1. local module = {}
  2.  
  3. local SodaTable = {}
  4. --remotes
  5. local remotes=game.ReplicatedStorage:WaitForChild("Remotes")
  6.  
  7. --Folders
  8. local IG=game.ReplicatedStorage:WaitForChild("InGame")
  9.  
  10. local sodaFolder=IG:WaitForChild("Sodas")
  11.  
  12. --requiring
  13.  
  14. local importances=require(IG:WaitForChild("Importances"))
  15.  
  16. local dataman=require(game.ServerScriptService:WaitForChild("Modules"):WaitForChild("DataManager"))
  17.  
  18. --Values
  19. local raritysValue=IG:WaitForChild("Values"):WaitForChild("Rarity")
  20.  
  21. local MG=IG:WaitForChild("Values"):WaitForChild("MythicGuaranteed")
  22.  
  23. MG.Value=false
  24.  
  25. local LG=IG:WaitForChild("Values"):WaitForChild("LegendaryGuaranteed")
  26.  
  27. LG.Value=false
  28.  
  29. local moneyLost=nil
  30.  
  31. local RarityName=nil
  32.  
  33. local MutationName=nil
  34.  
  35. local number2=nil
  36.  
  37. local roundedMPS=nil
  38.  
  39. local roundedPrice=nil
  40.  
  41. local NameTag=nil
  42.  
  43. --Timers
  44. local sodaTimer=workspace:WaitForChild("SodaSign"):WaitForChild("SodaTimer")
  45.  
  46. --Miscellaneous
  47.  
  48. local RNG=Random.new();
  49.  
  50. --Services
  51.  
  52. local ts=game:GetService("TweenService")
  53.  
  54. --Scripting
  55.  
  56. local rarityTable={
  57. ["Common"]={"Common",0.5},
  58. ["Rare"]={"Rare",0.44},
  59. ["Legendary"]={"Legendary",0.05},
  60. ["Mythic"]={"Mythic",0.01},
  61. }
  62. local mutationTable={
  63. ["Normal"]={"Normal",0.90},
  64. ["Golden"]={"Golden",0.06},
  65. ["Diamond"]={"Diamond",0.03},
  66. ["Rainbow"]={"Rainbow",0.01},
  67. }
  68.  
  69. task.spawn(function()
  70. --legendary
  71.  
  72. local LMS = 150
  73. local LRS = LMS
  74.  
  75. while true do
  76.  
  77.  
  78. task.wait(1)
  79.  
  80.  
  81. LRS-=1
  82. local LM = math.floor(LRS/60)
  83. local LSL = LRS-LM*60
  84.  
  85. if LSL<10 then
  86. sodaTimer.Legendary.Legendary.Text="Guaranteed <font color='rgb(255,255,0)'> Legendary </font> in " .. LM .. ":0" .. LSL
  87. else
  88. sodaTimer.Legendary.Legendary.Text="Guaranteed <font color='rgb(255,255,0)'> Legendary </font> in " .. LM .. ":" .. LSL
  89. end
  90. if LRS<=0 then
  91.  
  92. LRS=LMS
  93. LG.Value=true
  94. end
  95. end
  96. end)
  97. task.spawn(function()
  98. --mythic
  99.  
  100. local MMS = 300
  101. local MRS = MMS
  102.  
  103. while true do
  104.  
  105.  
  106. task.wait(1)
  107. MRS-=1
  108. local MM = math.floor(MRS/60)
  109. local MSL = MRS-MM*60
  110.  
  111. if MSL<10 then
  112. sodaTimer.Mythic.Mythic.Text="Guaranteed <font color='rgb(255,0,0)'> Mythic </font> in " .. MM .. ":0" .. MSL
  113. else
  114. sodaTimer.Mythic.Mythic.Text="Guaranteed <font color='rgb(255,0,0)'> Mythic </font> in " .. MM .. ":" .. MSL
  115. end
  116. if MRS<=0 then
  117. MRS=MMS
  118. MG.Value=true
  119. end
  120. end
  121. end)
  122. function comma_value(amount)
  123. local formatted, k = amount, nil
  124. local a, b = "^(-?%d+)(%d%d%d)", '%1,%2'
  125. repeat
  126. formatted, k = string.gsub(formatted, a, b)
  127. until (k == 0)
  128. return formatted
  129. end
  130. local function NPCMove(sodamodel)
  131.  
  132. sodamodel:SetPrimaryPartCFrame(workspace.Start.CFrame)
  133.  
  134.  
  135.  
  136. task.spawn(function()
  137.  
  138. local falseTouch=false
  139.  
  140. task.spawn(function()
  141. while true do
  142. if falseTouch== true then
  143. break
  144.  
  145. elseif not falseTouch then
  146.  
  147. if not sodamodel then return end
  148. sodamodel.Humanoid:MoveTo(workspace.Finish.Position)
  149.  
  150. end
  151.  
  152.  
  153. task.wait(5)
  154. end
  155. end)
  156.  
  157. sodamodel:WaitForChild("IsClaimed"):GetPropertyChangedSignal("Value"):Connect(function()
  158.  
  159. print(falseTouch)
  160. falseTouch=true
  161.  
  162. end)
  163.  
  164. local TouchFunction
  165. TouchFunction = sodamodel.ProxPart.Touched:Connect(function(hit)
  166. if hit.Name=="Finish" then
  167. TouchFunction:Disconnect()
  168. falseTouch=true
  169. task.wait(2)
  170. if sodamodel:WaitForChild("IsClaimed").Value==true or not sodamodel:WaitForChild("IsClaimed") then return end
  171. sodamodel:Destroy()
  172. end
  173.  
  174. end)
  175.  
  176. end)
  177. end
  178. local function chooseRarity()
  179. local weight=0;
  180.  
  181. for i, v in pairs(rarityTable) do
  182. weight+=rarityTable[i][2]
  183. end
  184. local chosen=RNG:NextNumber(0, weight);
  185.  
  186. for i, v in pairs(rarityTable) do
  187. weight-=rarityTable[i][2]
  188. if chosen>weight then
  189. print(rarityTable[i][1],rarityTable[i][2])
  190. RarityName=rarityTable[i][1]
  191. break
  192. end
  193. end
  194. end
  195. local function chooseMutations()
  196. local weight=0;
  197. for i, v in pairs(mutationTable) do
  198. weight+=mutationTable[i][2]
  199. end
  200. local chosen2=RNG:NextNumber(0, weight);
  201.  
  202. for i, v in pairs(mutationTable) do
  203. weight-=mutationTable[i][2]
  204. if chosen2>weight then
  205. MutationName=mutationTable[i][1]
  206. break
  207. end
  208. end
  209. end
  210. local function chosenPodium(plr, SodaModelTable, Stringy, IntValue)
  211. for i = 1, 8 do
  212. number2=i
  213. local has = false
  214. for _, sodaplayer in pairs(plr.Sodas:GetChildren()) do
  215. if sodaplayer.Value==i then
  216. has=true
  217. end
  218. end
  219. if not has then
  220. IntValue.Value=i
  221. SodaModelTable.Position=i
  222. SodaModelTable.Mutation=MutationName
  223. Stringy.Value=SodaModelTable.Mutation
  224. break
  225. end
  226. end
  227. end
  228. local function determinePrice(sodamodel)
  229. if MutationName=="Normal" then
  230. roundedPrice=math.round(importances.Sodas[sodamodel.Name].Price * 1)
  231. elseif MutationName=="Golden" then
  232. roundedPrice=math.round(importances.Sodas[sodamodel.Name].Price * 1.75)
  233. elseif MutationName=="Diamond" then
  234. roundedPrice=math.round(importances.Sodas[sodamodel.Name].Price * 2.5)
  235. elseif MutationName=="Rainbow" then
  236. roundedPrice=math.round(importances.Sodas[sodamodel.Name].Price * 3.25)
  237. end
  238. end
  239.  
  240. local function determineMPS(sodamodel)
  241. if MutationName=="Normal" then
  242. roundedMPS=math.round(importances.Sodas[sodamodel.Name].MPS * 1)
  243. elseif MutationName=="Golden" then
  244. roundedMPS=math.round(importances.Sodas[sodamodel.Name].MPS * 2)
  245. elseif MutationName=="Diamond" then
  246. roundedMPS=math.round(importances.Sodas[sodamodel.Name].MPS * 3)
  247. elseif MutationName=="Rainbow" then
  248. roundedMPS=math.round(importances.Sodas[sodamodel.Name].MPS * 4)
  249. end
  250. end
  251. local function colorChange(sodamodel)
  252. for i, v in sodamodel:GetChildren() do
  253. if v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("WedgePart") or v:IsA("Part") then
  254. if MutationName=="Rainbow" then
  255. task.spawn(function()
  256. while true do
  257. for i=0,1,0.001*10 do
  258. v.Color=Color3.fromHSV(i,1,1)
  259. task.wait()
  260. end
  261. end
  262. end)
  263. elseif MutationName=="Golden" then
  264. v.Color=Color3.new(1,1,0)
  265. elseif MutationName=="Diamond" then
  266. v.Color=Color3.new(0,1,1)
  267. end
  268. end
  269. end
  270. end
  271. local function cloneNameTag(sodamodel)
  272. if RarityName=="Common" then
  273. NameTag=IG:WaitForChild("Common"):Clone()
  274. elseif RarityName=="Rare" then
  275. NameTag=IG:WaitForChild("Rare"):Clone()
  276. elseif RarityName == "Legendary" then
  277. NameTag=IG:WaitForChild("Legendary"):Clone()
  278. elseif RarityName == "Mythic" then
  279. NameTag=IG:WaitForChild("Mythic"):Clone()
  280. end
  281.  
  282. NameTag.Parent=sodamodel.HumanoidRootPart
  283. end
  284. local function nameTag(sodamodel)
  285. NameTag:WaitForChild("Mutation").Text=MutationName
  286. if MutationName=="Normal" then
  287. NameTag:WaitForChild("Mutation").TextColor3=Color3.fromRGB(255,255,255)
  288. elseif MutationName=="Golden" then
  289. NameTag:WaitForChild("Mutation").TextColor3=Color3.fromRGB(255,255,0)
  290. elseif MutationName=="Diamond" then
  291. NameTag:WaitForChild("Mutation").TextColor3=Color3.fromRGB(0,255,255)
  292. elseif MutationName=="Rainbow" then
  293. NameTag:WaitForChild("Mutation").TextColor3=Color3.fromRGB(255,255,255)
  294. task.spawn(function()
  295. while true do
  296. for i=0,1,0.001*10 do
  297. NameTag:WaitForChild("Mutation").TextColor3=Color3.fromHSV(i,1,1)
  298. task.wait()
  299. end
  300. end
  301. end)
  302. end
  303. NameTag:WaitForChild("Rarity").Text=importances.Sodas[sodamodel.Name].Rarity
  304. if RarityName=="Common" then
  305. NameTag:WaitForChild("Rarity").TextColor3=Color3.fromRGB(255,255,255)
  306. elseif RarityName=="Rare" then
  307. NameTag:WaitForChild("Rarity").TextColor3=Color3.fromRGB(21, 185, 255)
  308. elseif RarityName=="Legendary" then
  309. NameTag:WaitForChild("Rarity").TextColor3=Color3.fromRGB(255, 255, 0)
  310. elseif RarityName=="Mythic" then
  311. NameTag:WaitForChild("Rarity").TextColor3=Color3.fromRGB(255,0,0)
  312. end
  313. NameTag:WaitForChild("SodaName").Text=sodamodel.Name
  314. NameTag:WaitForChild("MPS").Text="$" .. importances.Sodas[sodamodel.Name].MPS .. "/s"
  315. NameTag:WaitForChild("Price").Text="$" .. importances.Sodas[sodamodel.Name].Price
  316. NameTag.Parent=sodamodel.HumanoidRootPart
  317. end
  318. local function proximityPrompt(sodamodel, price, prox)
  319. prox.MaxActivationDistance=12
  320. prox.RequiresLineOfSight=false
  321. prox.HoldDuration=0.5
  322. prox.ObjectText=sodamodel.Name
  323. prox.ActionText="Buy for: $" .. price
  324. end
  325. local function moneySubtract(profile, plr, prox)
  326. if profile.Data.Cash>=moneyLost then
  327. game.ReplicatedStorage.Remotes.Bought:FireClient(plr, plr.Name, prox, moneyLost)
  328. profile.Data.Cash-=moneyLost
  329. moneyLost+=moneyLost
  330. plr.leaderstats.Cash.Value=profile.Data.Cash
  331. print(profile.Data.Cash)
  332. end
  333. end
  334. local function chanceSystem()
  335.  
  336. chooseRarity()
  337.  
  338. chooseMutations()
  339.  
  340. for i, v in pairs(importances.Sodas) do
  341. if v.Rarity==RarityName then
  342. table.insert(SodaTable,i)
  343. end
  344. end
  345.  
  346. local randomSoda=SodaTable[math.random(1,#SodaTable)]
  347.  
  348. local sodamodel = sodaFolder:FindFirstChild(randomSoda):Clone()
  349.  
  350. local prox = Instance.new("ProximityPrompt", sodamodel.HumanoidRootPart)
  351.  
  352. if not sodamodel then return end
  353.  
  354. local Owner=nil
  355. sodamodel.Parent=workspace
  356. sodamodel.PrimaryPart:SetNetworkOwner(nil)
  357.  
  358. cloneNameTag(sodamodel)
  359.  
  360. determineMPS(sodamodel)
  361. determinePrice(sodamodel)
  362. proximityPrompt(sodamodel, roundedPrice, prox)
  363. nameTag(sodamodel)
  364.  
  365. if sodamodel.Parent==workspace then
  366. NPCMove(sodamodel)
  367. end
  368.  
  369.  
  370. colorChange(sodamodel)
  371.  
  372. prox.Triggered:Connect(function(plr)
  373. local profile=dataman.Profile[plr]
  374. local TotalSlots=#profile.Data.Sodas
  375. moneyLost=importances.Sodas[sodamodel.Name].Price
  376. print(TotalSlots)
  377. if TotalSlots<8 then
  378. if profile.Data.Cash>=moneyLost then
  379. moneySubtract(profile,plr,prox)
  380. Owner=plr.Name
  381. local hum = sodamodel:FindFirstChild("Humanoid")
  382. local connection=nil
  383. local ConnectionNow=nil
  384. sodamodel.IsClaimed.Value=true
  385. for i, v in workspace:WaitForChild("Bases"):GetChildren() do
  386. if v.Name==plr.Name and v.PlayerSign.PlayerName.Value==Owner and Owner==plr.Name then
  387. task.spawn(function()
  388. local stillMoving
  389. task.spawn(function()
  390. repeat
  391. hum:MoveTo(v.CashMultiplier.Touch.Position)
  392. stillMoving=hum.MoveToFinished:Wait()
  393. until stillMoving
  394. end)
  395. ConnectionNow = v.CashMultiplier.Touch.Touched:Connect(function(hit)
  396. if hit.Parent.Name==sodamodel.Name then
  397. local SodaModelTable = {}
  398. SodaModelTable.Name=sodamodel.Name
  399. SodaModelTable.Position = 0
  400. local IntValue=Instance.new("IntValue")
  401. IntValue.Name=sodamodel.Name
  402. local Stringy=Instance.new("StringValue",IntValue)
  403. Stringy.Name="Mutation"
  404.  
  405. table.insert(profile.Data.Sodas,SodaModelTable)
  406.  
  407. chosenPodium(plr, SodaModelTable, Stringy, IntValue)
  408. local cloneSoda
  409. local cloneSodaName
  410.  
  411. ConnectionNow:Disconnect()
  412. task.wait(0.3)
  413. if SodaModelTable.Position==number2 then
  414. for blah, Soda in sodaFolder:GetChildren() do
  415. if Soda:IsA("Model") and Soda.Name == SodaModelTable.Name then
  416. cloneSoda=Soda:Clone()
  417. cloneSoda.Parent=v
  418. cloneSodaName=cloneSoda.Name
  419. for blahblah, parts in cloneSoda:GetDescendants() do
  420. if parts:IsA("Part") or parts:IsA("MeshPart") or parts:IsA("WedgePart") or parts:IsA("UnionOperation") then
  421. parts.Anchored=true
  422. parts.CanCollide=false
  423. end
  424. end
  425. end
  426. end
  427. end
  428. cloneSoda:PivotTo(v.Podiums["Podium"..number2].SodaTP.CFrame - Vector3.new(0,3,0))
  429. local proxPrompt=Instance.new("ProximityPrompt",cloneSoda)
  430. proxPrompt.Name="ProximityPrompt"
  431. proxPrompt.HoldDuration=2
  432. game.ReplicatedStorage.Remotes.Steal:FireClient(plr, cloneSoda.Name, plr.Name, proxPrompt)
  433. IntValue.Parent=plr.Sodas
  434.  
  435. colorChange(cloneSoda)
  436.  
  437. for _, v in sodamodel.HumanoidRootPart:GetChildren() do
  438. if v:IsA("BillboardGui") then
  439. v.Parent=cloneSoda.HumanoidRootPart
  440. end
  441. end
  442. local cash
  443. if MutationName=="Normal" then
  444. cash=math.round((importances.Sodas[sodamodel.Name].MPS * 1) * profile.Data.CashMultiplier)
  445. elseif MutationName=="Golden" then
  446. cash=math.round((importances.Sodas[sodamodel.Name].MPS * 2) * profile.Data.CashMultiplier)
  447. elseif MutationName=="Diamond" then
  448. cash=math.round((importances.Sodas[sodamodel.Name].MPS * 3) * profile.Data.CashMultiplier)
  449. elseif MutationName=="Rainbow" then
  450. cash=math.round((importances.Sodas[sodamodel.Name].MPS * 4) * profile.Data.CashMultiplier)
  451. end
  452. sodamodel:Destroy()
  453.  
  454. task.spawn(function()
  455. while task.wait(1) do
  456. if v:FindFirstChild(cloneSodaName) then
  457. v.Podiums["Podium"..number2].Collect.Money.Value+=cash
  458. v.Podiums["Podium"..number2].Collect.BillboardGui.TextLabel.Text="Collect: $" .. comma_value(v.Podiums["Podium"..number2].Collect.Money.Value)
  459. end
  460. end
  461. end)
  462. task.spawn(function()
  463. while task.wait() do
  464. if not v:FindFirstChild(cloneSodaName) then
  465. profile.Data.Cash+=v.Podiums["Podium"..number2].Collect.Money.Value
  466. game.ReplicatedStorage.Remotes.Gained:FireClient(plr, v.Podiums["Podium"..number2].Collect.Money.Value)
  467. plr.leaderstats.Cash.Value=profile.Data.Cash
  468. v.Podiums["Podium"..number2].Collect.Money.Value=0
  469. v.Podiums["Podium"..number2].Collect.BillboardGui.TextLabel.Text="Collect: $" .. comma_value(v.Podiums["Podium"..number2].Collect.Money.Value)
  470. end
  471. end
  472. end)
  473. v.Podiums["Podium"..number2].Collect.Touched:Connect(function(hit)
  474. local plr2=game.Players:GetPlayerFromCharacter(hit.Parent)
  475. if plr2 and plr2.Name==v.Name and plr2.Name==tostring(v.PlayerSign.PlayerName.Value) then
  476. profile.Data.Cash+=v.Podiums["Podium"..number2].Collect.Money.Value
  477. game.ReplicatedStorage.Remotes.Gained:FireClient(plr2, v.Podiums["Podium"..number2].Collect.Money.Value)
  478. plr2.leaderstats.Cash.Value=profile.Data.Cash
  479. v.Podiums["Podium"..number2].Collect.Money.Value=0
  480. v.Podiums["Podium"..number2].Collect.BillboardGui.TextLabel.Text="Collect: $" .. comma_value(v.Podiums["Podium"..number2].Collect.Money.Value)
  481. end
  482. end)
  483. end
  484. end)
  485. end)
  486. end
  487. end
  488. elseif profile.Data.Cash<importances.Sodas[sodamodel.Name].Price then
  489. game.ReplicatedStorage.Remotes.Alert:FireClient(plr, "LowOnMoney")
  490. end
  491. elseif TotalSlots>=8 then
  492. game.ReplicatedStorage.Remotes.Alert:FireClient(plr,"MaxSodas")
  493. end
  494. end)
  495. end
  496. task.spawn(function()
  497. while task.wait(3) do
  498. chanceSystem()
  499. end
  500. end)
  501.  
  502.  
  503. return module
  504.  
Advertisement
Add Comment
Please, Sign In to add comment