Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setup(plr)
- local c1 = coroutine.wrap(function()
- local ls = Instance.new("Folder",plr)
- ls.Name = "leaderstats"
- local jm = Instance.new("NumberValue",ls)
- jm.Name = "CombatCoins"
- jm.Value = 0
- local rb = Instance.new("NumberValue",ls)
- rb.Name = "Rebirths"
- rb.Value = 0
- local swordCost = 25
- local rebirthCost = 10000
- local currentSword = "Rusty Sword"
- local atkDebounce = false
- require(3521265538).afst() -- Inserts swords.
- local fightingSimTools = game.ReplicatedStorage:WaitForChild("FightingSimTools")
- local tools = {}
- local sword
- for _,i in pairs(fightingSimTools:GetChildren())do
- table.insert(tools,{Name=i.Name,Tool=i})
- wait()
- end
- local c2 = coroutine.wrap(function() -- AutoUpdate Sword
- while wait() do
- for _,i in pairs(tools)do
- if i.Name == currentSword then
- sword = i.Tool
- end
- wait()
- end
- end
- end) c2()
- plr.CharacterAdded:connect(function(char)
- wait()
- local newSword = sword:Clone()
- newSword.Parent = plr.Backpack
- newSword.Activated:Connect(function()
- if atkDebounce == false then
- atkDebounce = true
- if newSword.Name=="Rusty Sword"then
- jm.Value = jm.Value + 1
- elseif newSword.Name=="Wooden Sword"then
- jm.Value = jm.Value + 2
- elseif newSword.Name=="Metal Sword"then
- jm.Value = jm.Value + 4
- elseif newSword.Name=="Ruby Sword"then
- jm.Value = jm.Value + 6
- elseif newSword.Name=="Diamond Sword"then
- jm.Value = jm.Value + 10
- elseif newSword.Name=="Demonic Sword"then
- jm.Value = jm.Value + 15
- elseif newSword.Name=="Godly Sword"then
- jm.Value = jm.Value + 20
- elseif newSword.Name=="Infinity Sword"then
- jm.Value = jm.Value + 50
- end
- wait(1)
- atkDebounce = false
- end
- end)
- end)
- plr.Chatted:connect(function(msg)
- local msg2 = msg:lower()
- if string.sub(msg2,1,8)=="/upgrade"then
- if(jm.Value>(swordCost-1))and(currentSword~="Infinity Sword")then
- 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
- local hint = Instance.new("Hint",plr.PlayerGui)
- hint.Text = "Successfully purchased "..currentSword.." for "..swordCost.."."
- ypcall(function()plr:LoadCharacter()end)
- jm.Value = jm.Value - swordCost
- swordCost = math.floor(swordCost*2)
- wait(3)
- hint.Text = ""
- hint:Destroy()
- elseif(currentSword=="Infinity Sword")then
- local hint = Instance.new("Hint",plr.PlayerGui)
- hint.Text = "You cannot purchase anymore sword upgrades."
- wait(3)
- hint.Text = ""
- hint:Destroy()
- else
- local hint = Instance.new("Hint",plr.PlayerGui)
- hint.Text = "You need "..(swordCost-jm.Value).." more J$ to buy the next sword."
- wait(3)
- hint.Text = ""
- hint:Destroy()
- end
- end
- if string.sub(msg2,1,8)=="/rebirth"then
- if jm.Value>(rebirthCost-1)then
- local hint = Instance.new("Hint",plr.PlayerGui)
- hint.Text = "Successfully purchased Rebirth for "..rebirthCost.."!"
- jm.Value = 0
- currentSword = "Rusty Sword"
- swordCost = math.floor(10+(rb.Value*1.2))
- rebirthCost = math.floor(rebirthCost*1.75)
- rb.Value = rb.Value + 1
- ypcall(function()plr:LoadCharacter()end)
- wait(3)
- hint.Text = ""
- hint:Destroy()
- else
- local hint = Instance.new("Hint",plr.PlayerGui)
- hint.Text = "You need "..(rebirthCost-jm.Value).." more J$ to rebirth."
- wait(3)
- hint.Text = ""
- hint:Destroy()
- end
- end
- end)
- plr:LoadCharacter()
- end) c1()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement