Advertisement
Sungmingamerpro13

Technobrother Wins and Rounds with VIP(Main Game)

Sep 13th, 2022
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 KB | None | 0 0
  1. local TeleportService = game:GetService("TeleportService")
  2. local dVersion = 1
  3. local save = game:GetService("DataStoreService"):GetOrderedDataStore("Wins "..dVersion)
  4. local VIP = 50269448
  5.  
  6. game.Players.PlayerAdded:Connect(function(player)
  7. local previousData = save:GetAsync(player.UserId) -- Returns a number value.
  8.  
  9. local Wins
  10.  
  11. if previousData ~= nil then
  12. Wins = previousData
  13. else
  14. Wins = 0
  15. save:SetAsync(player.UserId, 0)
  16. end
  17.  
  18. local coinsValue = Instance.new("IntValue", player)
  19. coinsValue.Name = "Wins"
  20. coinsValue.Value = Wins
  21. end)
  22.  
  23. game:BindToClose(function() -- Runs whenver the server is about to shut down/stop.
  24. print("STOPPED!")
  25.  
  26. for i,player in pairs(game.Players:GetPlayers()) do
  27. local value = player.Wins.Value
  28. save:SetAsync(player.UserId, value)
  29. print("Saved data for "..player.Name)
  30. end
  31. end)
  32.  
  33. game.Players.PlayerRemoving:Connect(function(player)
  34. local value = player.Wins.Value
  35.  
  36. if value ~= nil then
  37. print("Found data to save for "..player.Name.."!")
  38. save:SetAsync(player.UserId, value)
  39. print("Saved data for "..player.Name)
  40. else
  41. print("Did not manage to find data to save for "..player.Name.."!")
  42. end
  43. end)
  44.  
  45. local save2 = game:GetService("DataStoreService"):GetOrderedDataStore("Rounds "..dVersion)
  46.  
  47. game.Players.PlayerAdded:Connect(function(player)
  48. local previousData = save2:GetAsync(player.UserId) -- Returns a number value.
  49.  
  50. local Rounds
  51.  
  52. if previousData ~= nil then
  53. Rounds = previousData
  54. else
  55. Rounds = 0
  56. save2:SetAsync(player.UserId, 0)
  57. end
  58.  
  59. local coinsValue = Instance.new("IntValue", player)
  60. coinsValue.Name = "Rounds"
  61. coinsValue.Value = Rounds
  62. end)
  63.  
  64. game:BindToClose(function() -- Runs whenver the server is about to shut down/stop.
  65. print("STOPPED!")
  66.  
  67. for i,player in pairs(game.Players:GetPlayers()) do
  68. local value = player.Rounds.Value
  69. save2:SetAsync(player.UserId, value)
  70. print("Saved data for "..player.Name)
  71. end
  72. end)
  73.  
  74. game.Players.PlayerRemoving:Connect(function(player)
  75. local value = player.Rounds.Value
  76.  
  77. if value ~= nil then
  78. print("Found data to save for "..player.Name.."!")
  79. save2:SetAsync(player.UserId, value)
  80. print("Saved data for "..player.Name)
  81. else
  82. print("Did not manage to find data to save for "..player.Name.."!")
  83. end
  84. end)
  85. local MoneySave = game:GetService("DataStoreService"):GetOrderedDataStore("Money "..dVersion)
  86.  
  87. game.Players.PlayerAdded:Connect(function(player)
  88. local previousData = MoneySave:GetAsync(player.UserId) -- Returns a number value.
  89.  
  90. local Money
  91.  
  92. if previousData ~= nil then
  93. Money = previousData
  94. else
  95. Money = 0
  96. MoneySave:SetAsync(player.UserId, 0)
  97. end
  98.  
  99. local coinsValue = Instance.new("IntValue", player)
  100. coinsValue.Name = "Money"
  101. coinsValue.Value = Money
  102. end)
  103.  
  104. game:BindToClose(function() -- Runs whenver the server is about to shut down/stop.
  105. print("STOPPED!")
  106.  
  107. for i,player in pairs(game.Players:GetPlayers()) do
  108. local value = player.Money.Value
  109. MoneySave:SetAsync(player.UserId, value)
  110. print("Saved data for "..player.Name)
  111. end
  112. end)
  113.  
  114. game.Players.PlayerRemoving:Connect(function(player)
  115. local value = player.Money.Value
  116.  
  117. if value ~= nil then
  118. print("Found data to save for "..player.Name.."!")
  119. MoneySave:SetAsync(player.UserId, value)
  120. print("Saved data for "..player.Name)
  121. else
  122. print("Did not manage to find data to save for "..player.Name.."!")
  123. end
  124. end)
  125. local CoinsSave = game:GetService("DataStoreService"):GetOrderedDataStore("Coins "..dVersion)
  126.  
  127. game.Players.PlayerAdded:Connect(function(player)
  128. local previousData = CoinsSave:GetAsync(player.UserId) -- Returns a number value.
  129.  
  130. local Coins
  131.  
  132. if previousData ~= nil then
  133. Coins = previousData
  134. else
  135. Coins = 0
  136. CoinsSave:SetAsync(player.UserId, 0)
  137. end
  138.  
  139. local coinsValue = Instance.new("IntValue", player)
  140. coinsValue.Name = "Coins"
  141. coinsValue.Value = Coins
  142.  
  143. local val1 = Instance.new("StringValue",player)
  144. val1.Name = 'GotPet'
  145. val1.Value = ''
  146.  
  147. local val2 = Instance.new("StringValue",player)
  148. val2.Name = 'OpenValue'
  149. val2.Value = ''
  150.  
  151. if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, VIP) then
  152. player.Coins.Value = player.Coins.Value *2
  153. end
  154. end)
  155.  
  156. game:BindToClose(function() -- Runs whenver the server is about to shut down/stop.
  157. print("STOPPED!")
  158.  
  159. for i,player in pairs(game.Players:GetPlayers()) do
  160. local value = player.Coins.Value
  161. CoinsSave:SetAsync(player.UserId, value)
  162. print("Saved data for "..player.Name)
  163. end
  164. end)
  165.  
  166. game.Players.PlayerRemoving:Connect(function(player)
  167. local value = player.Coins.Value
  168.  
  169. if value ~= nil then
  170. print("Found data to save for "..player.Name.."!")
  171. CoinsSave:SetAsync(player.UserId, value)
  172. print("Saved data for "..player.Name)
  173. else
  174. print("Did not manage to find data to save for "..player.Name.."!")
  175. end
  176. end)
  177. game.Players.PlayerRemoving:connect(function(player)
  178.  
  179. -------------Sets the deaths once the player joins------------------------------
  180. save2:SetAsync(player.UserId, player.Rounds.Value)
  181. ------------------------------------------------------------------
  182. end)
  183. game.Players.PlayerAdded:connect(function(player)
  184. player.CharacterAdded:connect(function(char)
  185.  
  186. char.Humanoid.Died:connect(function()
  187. player.Rounds.Value = player.Rounds.Value + 1
  188.  
  189. end)
  190. end)
  191. end)
  192.  
  193. game.Players.PlayerAdded:Connect(function(player)
  194. local Deaths = Instance.new("NumberValue")
  195. Deaths.Parent = player
  196. Deaths.Name = "Deaths"
  197. Deaths.Value = 0
  198.  
  199. player.CharacterAdded:Connect(function(char)
  200. char.Humanoid.Died:Connect(function()
  201. player.Deaths.Value = player.Deaths.Value + 1
  202. end)
  203. end)
  204. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement