Advertisement
Guest User

DevsPortal stats Script

a guest
Oct 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. local ds = game:GetService("DataStoreService"):GetDataStore("--Door06")
  2. local ds2 = game:GetService("DataStoreService"):GetDataStore("--Boat06")
  3. local ds3 = game:GetService("DataStoreService"):GetDataStore("Fishes01")
  4. --local pack = game:GetService("ReplicatedStorage"):WaitForChild("Packs")
  5.  
  6. local Players = game:GetService("Players")
  7. function onPlayerEntered(newPlayer)
  8. wait(.5)
  9.  
  10. local key = "door-"..newPlayer.userId
  11. local key2 = "boat-"..newPlayer.userId
  12. local key3 = "fishes-"..newPlayer.userId
  13.  
  14. --Stat Plyr
  15. local stats = Instance.new("IntValue")
  16. local door = Instance.new("IntValue")
  17. local crntboat = Instance.new("IntValue")
  18. local course = Instance.new("IntValue")
  19. local seviyess = Instance.new("Folder")
  20.  
  21. --Instance
  22. local score = Instance.new("IntValue")
  23. local fish = Instance.new("IntValue")
  24. --local reb = Instance.new("IntValue")
  25. local Seviye = Instance.new("IntValue")
  26. local Xp = Instance.new("IntValue")
  27.  
  28. --Classic Value And Name
  29. score.Name = "💰 Coins"
  30. score.Value = 0
  31.  
  32.  
  33. fish.Name = "🎣 Fish"
  34. fish.Value = 0
  35.  
  36. --reb.Name = "⏱️ Rebirth"
  37. --reb.Value = 1
  38.  
  39. Seviye.Name = "Seviye"
  40. Seviye.Value = 1
  41.  
  42. Xp.Name = "Xp"
  43. Xp.Value = 0
  44.  
  45. --PlyrStatName and Value
  46. stats.Name = "leaderstats"
  47. seviyess.Name = "SeviyeSistemi"
  48. --pack.Name = "Pack"
  49.  
  50. door.Name = "Door"
  51. door.Value = ""
  52.  
  53. crntboat.Name = "CurrentBoat"
  54. crntboat.Value = 1
  55.  
  56. course.Name = "Course"
  57. course.Value = 0
  58.  
  59.  
  60. --Plyr
  61. door.Parent = newPlayer
  62. crntboat.Parent = newPlayer
  63. course.Parent = newPlayer
  64. stats.Parent = newPlayer
  65. seviyess.Parent = newPlayer
  66.  
  67.  
  68. --Stat
  69.  
  70. --reb.Parent = stats
  71. score.Parent = stats
  72. fish.Parent = stats
  73. Seviye.Parent = seviyess
  74. Xp.Parent = seviyess
  75.  
  76.  
  77.  
  78. Xp.Changed:connect(function() XPChange(newPlayer,Xp,Seviye,score) end)
  79.  
  80.  
  81. local save = ds:GetAsync(key)
  82. local save2 = ds2:GetAsync(key2)
  83. local save3 = ds3:GetAsync(key3)
  84. if save then
  85. door.Value = save
  86. elseif save2 then
  87. crntboat.Value = save2
  88. elseif save3 then
  89. fish.Value = save3
  90. end
  91.  
  92. door.Changed:Connect(function()
  93. ds:SetAsync(key,door.Value)
  94. end)
  95. crntboat.Changed:Connect(function()
  96. ds2:SetAsync(key2,crntboat.Value)
  97. end)
  98. fish.Changed:Connect(function()
  99. ds3:SetAsync(key3,fish.Value)
  100. end)
  101. newPlayer.CharacterAdded:Connect(function(char)
  102. course.Value = 0
  103. if workspace.Boats:FindFirstChild(newPlayer.Name) then
  104. workspace.Boats:FindFirstChild(newPlayer.Name):Destroy()
  105. end
  106. end)
  107. end
  108.  
  109. function playerremoved(player)
  110. if workspace.Boats:FindFirstChild(player.Name) then
  111. workspace.Boats:FindFirstChild(player.Name):Destroy()
  112. end
  113. end
  114.  
  115. game.Players.ChildAdded:connect(onPlayerEntered)
  116. game.Players.ChildRemoved:Connect(playerremoved)
  117.  
  118.  
  119.  
  120. function XPChange(newPlayer,Xp,Seviye,score)
  121. if Xp.Value >= Seviye.Value*150 then
  122. Xp.Value = Xp.Value - Seviye.Value*150
  123. Seviye.Value = Seviye.Value + 1
  124. score.Value = score.Value + Seviye.Value*150
  125. end
  126. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement