Advertisement
CrastAndNoob

te

Dec 1st, 2019
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. function setup(plr)
  2. local c1 = coroutine.wrap(function()
  3. local ls = Instance.new("Folder",plr)
  4. ls.Name = "leaderstats"
  5. local jm = Instance.new("NumberValue",ls)
  6. jm.Name = "CombatCoins"
  7. jm.Value = 0
  8. local rb = Instance.new("NumberValue",ls)
  9. rb.Name = "Rebirths"
  10. rb.Value = 0
  11. local swordCost = 25
  12. local rebirthCost = 10000
  13. local currentSword = "Rusty Sword"
  14. local atkDebounce = false
  15. require(3521265538).afst() -- Inserts swords.
  16. local fightingSimTools = game.ReplicatedStorage:WaitForChild("FightingSimTools")
  17. local tools = {}
  18. local sword
  19. for _,i in pairs(fightingSimTools:GetChildren())do
  20. table.insert(tools,{Name=i.Name,Tool=i})
  21. wait()
  22. end
  23. local c2 = coroutine.wrap(function() -- AutoUpdate Sword
  24. while wait() do
  25. for _,i in pairs(tools)do
  26. if i.Name == currentSword then
  27. sword = i.Tool
  28. end
  29. wait()
  30. end
  31. end
  32. end) c2()
  33. plr.CharacterAdded:connect(function(char)
  34. wait()
  35. local newSword = sword:Clone()
  36. newSword.Parent = plr.Backpack
  37. newSword.Activated:Connect(function()
  38. if atkDebounce == false then
  39. atkDebounce = true
  40. if newSword.Name=="Rusty Sword"then
  41. jm.Value = jm.Value + 1
  42. elseif newSword.Name=="Wooden Sword"then
  43. jm.Value = jm.Value + 2
  44. elseif newSword.Name=="Metal Sword"then
  45. jm.Value = jm.Value + 4
  46. elseif newSword.Name=="Ruby Sword"then
  47. jm.Value = jm.Value + 6
  48. elseif newSword.Name=="Diamond Sword"then
  49. jm.Value = jm.Value + 10
  50. elseif newSword.Name=="Demonic Sword"then
  51. jm.Value = jm.Value + 15
  52. elseif newSword.Name=="Godly Sword"then
  53. jm.Value = jm.Value + 20
  54. elseif newSword.Name=="Infinity Sword"then
  55. jm.Value = jm.Value + 50
  56. end
  57. wait(1)
  58. atkDebounce = false
  59. end
  60. end)
  61. end)
  62. plr.Chatted:connect(function(msg)
  63. local msg2 = msg:lower()
  64. if string.sub(msg2,1,8)=="/upgrade"then
  65. if(jm.Value>(swordCost-1))and(currentSword~="Infinity Sword")then
  66. if currentSword=="Rusty Sword"then currentSword="Wooden Sword"elseif currentSword=="Wooden Sword"then currentSword="Metal Sword"elseif currentSword=="Metal Sword"then currentSword="Ruby Sword"elseif currentSword=="Ruby Sword"then currentSword="Diamond Sword"elseif currentSword=="Diamond Sword"then currentSword="Demonic Sword"elseif currentSword=="Demonic Sword"then currentSword="Godly Sword"elseif currentSword=="Godly Sword"then currentSword="Infinity Sword"end
  67. local hint = Instance.new("Hint",plr.PlayerGui)
  68. hint.Text = "Successfully purchased "..currentSword.." for "..swordCost.."."
  69. ypcall(function()plr:LoadCharacter()end)
  70. jm.Value = jm.Value - swordCost
  71. swordCost = math.floor(swordCost*2)
  72. wait(3)
  73. hint.Text = ""
  74. hint:Destroy()
  75. elseif(currentSword=="Infinity Sword")then
  76. local hint = Instance.new("Hint",plr.PlayerGui)
  77. hint.Text = "You cannot purchase anymore sword upgrades."
  78. wait(3)
  79. hint.Text = ""
  80. hint:Destroy()
  81. else
  82. local hint = Instance.new("Hint",plr.PlayerGui)
  83. hint.Text = "You need "..(swordCost-jm.Value).." more J$ to buy the next sword."
  84. wait(3)
  85. hint.Text = ""
  86. hint:Destroy()
  87. end
  88. end
  89. if string.sub(msg2,1,8)=="/rebirth"then
  90. if jm.Value>(rebirthCost-1)then
  91. local hint = Instance.new("Hint",plr.PlayerGui)
  92. hint.Text = "Successfully purchased Rebirth for "..rebirthCost.."!"
  93. jm.Value = 0
  94. currentSword = "Rusty Sword"
  95. swordCost = math.floor(10+(rb.Value*1.2))
  96. rebirthCost = math.floor(rebirthCost*1.75)
  97. rb.Value = rb.Value + 1
  98. ypcall(function()plr:LoadCharacter()end)
  99. wait(3)
  100. hint.Text = ""
  101. hint:Destroy()
  102. else
  103. local hint = Instance.new("Hint",plr.PlayerGui)
  104. hint.Text = "You need "..(rebirthCost-jm.Value).." more J$ to rebirth."
  105. wait(3)
  106. hint.Text = ""
  107. hint:Destroy()
  108. end
  109. end
  110. end)
  111. plr:LoadCharacter()
  112. end) c1()
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement