iiFlamez

Untitled

Mar 25th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.61 KB | None | 0 0
  1. wait(0.5)
  2.  
  3. --Start of CreateButton
  4. function CreateDict(Table)
  5. local PlayerF = {}
  6. for i,v in next, Table do
  7. if not v:IsA("Folder") then
  8. PlayerF[v.Name] = v.Value
  9. end
  10. end
  11. return PlayerF
  12. end
  13.  
  14.  
  15. function Count(Table)
  16. local Count = 0;
  17. for i,v in next, Table do
  18. Count = Count+1
  19. end
  20. return Count;
  21. end
  22.  
  23. function Check(PFolder,Requirments)
  24. local Count = 0;
  25. for i,v in next, Requirments do
  26. if tonumber(PFolder[i]) ~= nil and PFolder[i] and tonumber(PFolder[i]) >= tonumber(v) then
  27. Count = Count+1;
  28. elseif tostring(PFolder[i])~= nil and PFolder[i] and tostring(PFolder[i]) == tostring(v) then
  29. Count = Count+1;
  30. end
  31. end
  32. return Count;
  33. end
  34.  
  35. --[[Button must be the button instance not the click detector,
  36. Requirements must be the dictionary of Requirements
  37. Stat is the Stat to be indexed if they meet the requirement
  38. Value is what the stats value should be set to if they meet the requirement
  39. --]]
  40.  
  41. function CreateClick(Button,Requirements,Stat,Value)
  42. local Original = Button.Name;
  43. local Debounce = false;
  44. Button.Head.ClickDetector.MouseClick:connect(function(PLAYER)
  45. if Debounce then
  46. return
  47. end
  48. local PFolder = game:GetService("ServerStorage").PlayerFolders:WaitForChild(tostring(PLAYER))
  49. local PFolderDict = CreateDict(PFolder:GetChildren());
  50. if Count(Requirements) ~= Check(PFolderDict,Requirements) then
  51. Button.Name = "Improper requirements";
  52. Debounce = true;
  53. wait(2);
  54. Debounce = false;
  55. Button.Name = Original;
  56. elseif Count(Requirements) == Check(PFolderDict,Requirements) then
  57. Debounce = true;
  58. if Requirements["Gold"] then
  59. PFolder.Gold.Value = PFolder.Gold.Value - Requirements["Gold"];
  60. end
  61. if Requirements["Bounty"] then
  62. PFolder.Bounty.Value = PFolder.Bounty.Value - (Requirements["Bounty"]/2);
  63. end
  64. PFolder[Stat].Value = Value;
  65. Button.Name = "Success!"
  66. wait(2);
  67. Debounce = false;
  68. Button.Name = Original;
  69. end
  70. end)
  71. end
  72.  
  73. --End of CreateClick function
  74.  
  75. --Whatever is here has been compressed to my best of abilities.
  76. shops={}doctors={}skills={}levels={}local a={}function find(b)for c,d in pairs(b:GetChildren())do if d.Name=="ShopData"and d.Parent:findFirstChild("BasicShop",true)then shops[#shops+1]=d.Parent elseif d.Name=="Visit Doctor"then doctors[#doctors+1]=d.Head elseif d.Name=="ShopData"and d.Parent:findFirstChild("SkillShop",true)then skills[#skills+1]=d.Parent elseif d.Name=="ShopData"and d.Parent:findFirstChild("LevelShop",true)then levels[#levels+1]=d.Parent elseif d.Name=="ShopData"and d.Parent:findFirstChild("Trade",true)then a[#a+1]=d.Parent elseif d:IsA("BasePart")and d.Name=="Head"then find(d)elseif d:IsA("Model")then find(d)end end end;find(game.Workspace)function setupshop(e)local f=true;if e.ShopData:findFirstChild("MarineOnly")then e.BrickColor=BrickColor.new("Bright blue")else e.BrickColor=BrickColor.new("Bright green")end;e.ShopData.Cost.Value=math.floor(e.ShopData.Cost.Value*(math.random(1,2)+math.random()))e.Parent.Name=""..e.ShopData.Item.Value.." $"..e.ShopData.Cost.Value..""e.ClickDetector.MouseClick:connect(function(g)if g~=nil then if not f then return end;f=false;e.BrickColor=BrickColor.new("Bright red")local h=game.ServerStorage.PlayerFolders:WaitForChild(g.Name)if e:findFirstChild(h.Race.Value,true)then e.Parent.Name="Not allowed for "..h.Race.Value.."s"wait(1)e.Parent.Name=""..e.ShopData.Item.Value.." $"..e.ShopData.Cost.Value..""if e.ShopData:findFirstChild("MarineOnly")then e.BrickColor=BrickColor.new("Bright blue")else e.BrickColor=BrickColor.new("Bright green")end;f=true;return end;if h then local i=true;local j=nil;local skills=nil;local k=true;skills=game:GetService("HttpService"):JSONDecode(h.Skills.Value)if e.ShopData:findFirstChild("Req")then skills=game:GetService("HttpService"):JSONDecode(h.Skills.Value)j=game:GetService("HttpService"):JSONDecode(e.ShopData.Req.Value)for c,d in pairs(j)do if skills[c]and skills[c]>=d then else i=false;k=false end end end;if e.ShopData:findFirstChild("OneType")then for c,d in pairs(g.Backpack:GetChildren())do if d:findFirstChild("Type")and d.Type.Value==e.ShopData.OneType.Value then i=false end end;if g.Character:findFirstChild("Type",true)and g.Character:findFirstChild("Type",true).Value==e.ShopData.OneType.Value then i=false end;if skills["Arsenal"]and not g.Backpack:FindFirstChild(e.ShopData.Item.Value)and not g.Character:FindFirstChild(e.ShopData.Item.Value)then i=true end end;if e.ShopData:findFirstChild("MarineOnly")and h.Class.Value~="Marine"then i=false end;if e.ShopData:findFirstChild("RebelOnly")and h.Class.Value~="Revolutionary"then i=false end;if h.Gold.Value>=e.ShopData.Cost.Value and i then local l=g.Character:FindFirstChild("Rings")if l and l:FindFirstChild("Bargain Ring")and math.random(1,2)==1 then h.Gold.Value=h.Gold.Value-e.ShopData.Cost.Value/2 else h.Gold.Value=h.Gold.Value-e.ShopData.Cost.Value end;e.Parent.Name="Bought "..e.ShopData.Item.Value..""if game.ServerStorage.Tools:FindFirstChild(e.ShopData.Item.Value,true)then game.ServerStorage.Tools:FindFirstChild(e.ShopData.Item.Value,true):clone().Parent=g.Backpack end elseif i==false then if k==false then e.Parent.Name="Skill in this field isnt high enough!"wait(0.3)elseif e.ShopData:findFirstChild("MarineOnly")and h.Class.Value~="Marine"then e.Parent.Name="Marines only!"wait(0.3)elseif e.ShopData:findFirstChild("RebelOnly")and h.Class.Value~="Revolutionary"then e.Parent.Name="Revolutionaries only!"wait(0.3)else e.Parent.Name="You can only have one!"wait(0.3)end else e.Parent.Name="Can't afford "..e.ShopData.Item.Value.."!"wait(0.3)end end;wait(0.3)e.Parent.Name=""..e.ShopData.Item.Value.." $"..e.ShopData.Cost.Value..""if e.ShopData:findFirstChild("MarineOnly")then e.BrickColor=BrickColor.new("Bright blue")else e.BrickColor=BrickColor.new("Bright green")end;f=true end end)end;prices={["Cut"]=500,["Bruise"]=600,["Puncture"]=700,["Cold"]=700,["Infection"]=1100,["Cough"]=1700,["Large Cut"]=2500,["Scurvy"]=5000,["Malnutrition"]=6000}function setupdoc(e)local m=e.Parent;local f=true;m.Name="Visit Doctor"e.ClickDetector.MouseClick:connect(function(g)if g~=nil then if not f then return end;f=false;local h=game.ServerStorage.PlayerFolders:WaitForChild(g.Name)if h then local n=0;e.BrickColor=BrickColor.new("Bright red")local o=game:GetService("HttpService"):JSONDecode(h.HealthConditions.Value)for c,d in pairs(o)do if prices[d]and h.Gold.Value>=prices[d]then h.Gold.Value=h.Gold.Value-prices[d]table.remove(o,c)elseif prices[d]then n=n+prices[d]else end end;if n~=0 then m.Name="You still need $"..n end;h.HealthConditions.Value=game:GetService("HttpService"):JSONEncode(o)wait(1)m.Name="Visit Doctor"e.BrickColor=BrickColor.new("Bright green")f=true end end end)end;function setuptrade(e)local m=e.Parent;local f=true;m.Name=e.ShopData.Item.Value.." : "..e.ShopData.Trade.Value.." (x"..e.ShopData.Amount.Value..") "e.ClickDetector.MouseClick:connect(function(g)if g~=nil then if not f then return end;f=false;local h=game.ServerStorage.PlayerFolders:WaitForChild(g.Name)if h then local p=0;for c,d in pairs(g.Backpack:GetChildren())do if d.Name==e.ShopData.Trade.Value then p=p+1 end end;if p>=e.ShopData.Amount.Value then for q=1,e.ShopData.Amount.Value do if g.Backpack:findFirstChild(e.ShopData.Trade.Value)then g.Backpack:findFirstChild(e.ShopData.Trade.Value):Destroy()end end;local r=game.ServerStorage.Tools:FindFirstChild(e.ShopData.Item.Value,true):clone()r.Parent=g.Backpack end end;wait(0.5)f=true end end)end;function commaValue(s)local t=s;local u;repeat t,u=string.gsub(t,"^(-?%d+)(%d%d%d)",'%1,%2')until u==0;return t end;function setupskill(e)local f=true;e.BrickColor=BrickColor.new("Bright yellow")e.Parent.Name=""..e.ShopData.Item.Value.." $"..commaValue(e.ShopData.Cost.Value)..", "..commaValue(e.ShopData.CostB.Value*10).."B"e.ClickDetector.MouseClick:connect(function(g)if g~=nil then if not f then return end;f=false;e.BrickColor=BrickColor.new("Bright yellow")local h=game.ServerStorage.PlayerFolders:WaitForChild(g.Name)if h then if e:findFirstChild(h.Race.Value,true)then e.Parent.Name="Not allowed for "..h.Race.Value.."s"wait(1)f=true;return end;local i=true;local v=true;local w=true;local skills=game:GetService("HttpService"):JSONDecode(h.Skills.Value)local j=game:GetService("HttpService"):JSONDecode(e.ShopData.Req.Value)for c,d in pairs(j)do if skills[c]and skills[c]>=d or skills[c]==nil and d==0 then if c=="Mirage"and skills["Cannon"]or c=="Cannon"and skills["Mirage"]or c=="Impact"and skills["Barrage"]or c=="Barrage"and skills["Impact"]or c=="1sProjectile"and skills["1sParry"]or c=="1sParry"and skills["1sProjectile"]or c=="Yeet"and skills["Heavy"]or c=="Heavy"and skills["Yeet"]or c=="Reload"and skills["CannonMaster"]or c=="CannonMaster"and skills["Reload"]or c=="Spin"and skills["Pound"]or c=="Pound"and skills["Spin"]or c=="SamuraiAOE"and skills["Slice"]or c=="Slice"and skills["SamuraiAOE"]or c=="Slashes"and not skills["Cannon"]or c=="DragonsBreath"and not skills["Barrage"]or c=="SamuraiAOE"and not skills["SamuraiCounter"]or c=="WaterDash"and not skills["Wavey"]or c=="Wavey"and not skills["WaterDash"]or c=="Blocker"and not skills["Reload"]or c=="Arsenal"and not skills["CannonMaster"]then w=false end else i=false end end;if j["Rokushiki"]and h.Race.Value~="Human"or j["Fishman Karate"]and h.Race.Value~="Fishman"or j["Dwarf"]and h.Race.Value~="Dwarf"then v=false end;if h.Race.Value=="Human"then w=true end;if h.Gold.Value>=e.ShopData.Cost.Value and h.Bounty.Value>=e.ShopData.CostB.Value and i and v and w then if h.SkillsLeft.Value==0 then f=true;return end;if h.Race.Value=="Giant"then return end;h.SkillsLeft.Value=h.SkillsLeft.Value-1;e.Parent.Name="Learned "..e.ShopData.Item.Value..""h.EXP.Value=h.EXP.Value+500;for c,d in pairs(j)do if skills[c]and skills[c]==d then skills[c]=d+1 elseif not skills[c]then skills[c]=1 end end;h.Skills.Value=game:GetService("HttpService"):JSONEncode(skills)h.Bounty.Value=h.Bounty.Value-e.ShopData.CostB.Value/2;h.Gold.Value=h.Gold.Value-e.ShopData.Cost.Value elseif i==false then e.Parent.Name="Skill in this field isnt high enough!"elseif not v then e.Parent.Name=h.Race.Value.."'s cannot obtain this skill!"elseif w==false then e.Parent.Name="You can only go one path!"elseif h.Gold.Value<e.ShopData.Cost.Value then e.Parent.Name="Can't afford "..e.ShopData.Item.Value.."!"elseif h.Bounty.Value<e.ShopData.CostB.Value then e.Parent.Name="Need more bounty!"end end;wait(2)e.Parent.Name=""..e.ShopData.Item.Value.." $"..commaValue(e.ShopData.Cost.Value)..", "..commaValue(e.ShopData.CostB.Value*10).."B"e.BrickColor=BrickColor.new("Bright yellow")f=true end end)end;skillys={["Soru"]=true,["Geppo"]=true}function setupslevl(e)local f=true;e.BrickColor=BrickColor.new("Hot pink")e.Parent.Name=e.ShopData.Item.Value.."| 35k Bounty"e.ClickDetector.MouseClick:connect(function(g)if g~=nil then if not f then return end;f=false;e.BrickColor=BrickColor.new("Hot pink")local h=game.ServerStorage.PlayerFolders:WaitForChild(g.Name)if h then local i=true;local skills=game:GetService("HttpService"):JSONDecode(h.Skills.Value)local j=game:GetService("HttpService"):JSONDecode(e.ShopData.Req.Value)for c,d in pairs(skills)do if skillys[c]and(not skills["Rokushiki"]or skills["Rokushiki"]~=4)then i=false end end;if h.LVL.Value>=e.ShopData.LevelShop.Value and i and h.Bounty.Value>=3500 then if h.Race.Value=="Giant"then return end;e.Parent.Name="Learned "..e.ShopData.Item.Value..""for c,d in pairs(j)do if skills[c]and skills[c]==d then skills[c]=d+1 elseif not skills[c]then skills[c]=1 end end;h.Skills.Value=game:GetService("HttpService"):JSONEncode(skills)elseif i==false then e.Parent.Name="Only 1 purple skill allowed!"elseif h.Bounty.Value<3500 then e.Parent.Name="Not enough bounty!"elseif h.LVL.Value<e.ShopData.LevelShop.Value then e.Parent.Name="Level not high enough!"end end;wait(2)e.BrickColor=BrickColor.new("Hot pink")e.Parent.Name=e.ShopData.Item.Value.."| 35k Bounty"f=true end end)end;for c,d in pairs(shops)do setupshop(d)end;for c,d in pairs(a)do setuptrade(d)end;for c,d in pairs(doctors)do setupdoc(d)end;for c,d in pairs(skills)do setupskill(d)end;for c,d in pairs(levels)do setupslevl(d)end;local x=false;RebirthPart=workspace:WaitForChild("Rebirth")workspace.Rebirth.Head.ClickDetector.MouseClick:Connect(function(y)local h=game.ServerStorage.PlayerFolders:WaitForChild(y.Name)local z=game:GetService("HttpService"):JSONDecode(h.Skills.Value)if h.Bounty.Value>=5000 and h.LVL.Value>=15 and not x and h.Rebirth.Value<5 then x=true;local A=false;for c,d in pairs(z)do print(d)if d>=3 then A=true end end;if A==true then h.Bounty.Value=0;h.Skills.Value="[]"h.Gold.Value=5000;h.GiantCutlass.Value=false;h.DwarfUpgrade.Value=false;h.DwarfUpgrade2.Value=false;h.DwarfUpgrade3.Value=false;h.SkypieanUpgrade.Value=false;h.SkypieanUpgrade2.Value=false;h.SkypeianUpgrade3.Value=false;h.CyborgUpgrade3.Value=false;h.CyborgUpgrade2.Value=false;h.CyborgUpgrade.Value=false;h.FishmanUpgrade.Value=false;h.GiantUpgrade.Value=false;h.GiantUpgrade2.Value=false;h.GiantCutlass2.Value=false;h.MinkUpgradee.Value=false;h.Buso3.Value=false;h.Ken3.Value=false;h.Muscle.Value=0;h.Fat.Value=0;h.LVL.Value=1;h.EXP.Value=0;h.BankGold.Value=10000;h.Stomach.Value=h.Stomach.MaxValue;h.HealthConditions.Value="[]"h.Rebirth.Value=h.Rebirth.Value+1;h.SkillsLeft.Value=5+h.Rebirth.Value;if math.random(1,50/h.Rebirth.Value)==1 then h.HaoBorn.Value=true end;y:LoadCharacter()RebirthPart.Name="REBORNNNNNNNNNNNNNNNNNNNN!"wait(2)RebirthPart.Name="Rebirth"x=false else RebirthPart.Name="..."wait(2)x=false;RebirthPart.Name="Rebirth"end elseif not x then RebirthPart.Name="..."wait(2)x=false;RebirthPart.Name="Rebirth"end end)
  77. --End of that....
  78.  
  79. --Cyborg Race Upgrades
  80. local CyborgReq1 = {["Gold"] = 10000,["LVL"] = 5,["Race"] = "Cyborg",["CyborgUpgrade"] = false}
  81. local CyborgReq2 = {["Gold"] = 20000,["LVL"] = 10,["Race"] = "Cyborg",["CyborgUpgrade"] = true,["CyborgUpgrade2"] = false}
  82. local CyborgReq3 = {["Gold"] = 40000,["LVL"] = 15,["Race"] = "Cyborg",["CyborgUpgrade"] = true,["CyborgUpgrade2"] = true,["CyborgUpgrade3"] = false}
  83.  
  84. CreateClick(workspace["Cyborg Upgrade [10k Beli] [Level 5]"],CyborgReq1,"CyborgUpgrade",true)
  85. CreateClick(workspace["Cyborg Upgrade2 [20k Beli] [Level 10]"],CyborgReq2,"CyborgUpgrade2",true)
  86. CreateClick(workspace["Cyborg Upgrade3 [40k Beli] [Level 15]"],CyborgReq3,"CyborgUpgrade3",true)
  87.  
  88. --Fishmen Race Upgrades
  89. local FishmanReq1 = {["Gold"] = 30000,["LVL"] = 5,["Race"] = "Fishman",["FishmanUpgrade"] = false}
  90. local FishmanReq2 = {["Gold"] = 30000,["LVL"] = 10,["Race"] = "Fishman",["FishmanUpgrade"] = true,["FishmanUpgrade2"] = false}
  91.  
  92. CreateClick(workspace["Fishman Upgrade [30k Beli] [Level 5]"],FishmanReq1,"FishmanUpgrade",true)
  93. CreateClick(workspace["Fishman Upgrade 2 [30k Beli] [Level 10]"],FishmanReq2,"FishmanUpgrade2",true)
  94.  
  95. --Giant Race Upgrades
  96. local GiantReq1 = {["Gold"] = 30000,["LVL"] = 5,["Race"] = "Giant",["GiantUpgrade"] = false}
  97. local GiantReq2 = {["Gold"] = 40000,["LVL"] = 10,["Race"] = "Giant",["GiantUpgrade"] = true,["GiantUpgrade2"] = false}
  98. local GiantReq3 = {["Gold"] = 60000,["LVL"] = 15,["Race"] = "Giant",["GiantUpgrade"] = true,["GiantUpgrade2"] = true,["GiantUpgrade3"] = false}
  99.  
  100. CreateClick(workspace["Giant Upgrade [30k Beli] [Level 5]"],GiantReq1,"GiantUpgrade",true)
  101. CreateClick(workspace["Giant Upgrade2 [40k Beli] [Level 10]"],GiantReq2,"GiantUpgrade2",true)
  102. CreateClick(workspace["Giant Upgrade3 [60k Beli] [Level 15]"],GiantReq3,"GiantUpgrade3",true)
  103.  
  104. --Giant Sword Upgrades
  105. local GiantSwordReq1 = {["Gold"] = 20000,["Bounty"] = 1500,["Race"] = "Giant",["GiantCutlass"] = false}
  106. local GiantSwordReq2 = {["Gold"] = 40000,["Bounty"] = 3000,["Race"] = "Giant",["GiantCutlass"] = true,["GiantCutlass2"] = false}
  107.  
  108. CreateClick(workspace["Giant Sword Upgrade [20k Beli] [15k Bounty]"],GiantSwordReq1,"GiantCutlass",true)
  109. CreateClick(workspace["Giant Sword Upgrade2 [40k Beli] [30k Bounty]"],GiantSwordReq2,"GiantCutlass2",true)
  110.  
  111. --Dwarf Race Upgrades
  112. local DwarfReq1 = {["Gold"] = 20000,["LVL"] = 5,["Race"] = "Dwarf",["DwarfUpgrade"] = false}
  113. local DwarfReq2 = {["Gold"] = 40000,["LVL"] = 10,["Race"] = "Dwarf",["DwarfUpgrade"] = true,["DwarfUpgrade2"] = false}
  114. local DwarfReq3 = {["Gold"] = 60000,["LVL"] = 15,["Race"] = "Dwarf",["DwarfUpgrade"] = true,["DwarfUpgrade2"] = true,["DwarfUpgrade3"] = false}
  115.  
  116. CreateClick(workspace["Dwarf Upgrade [20k Beli] [Level 5]"],DwarfReq1,"DwarfUpgrade",true)
  117. CreateClick(workspace["Dwarf Upgrade2 [40k Beli] [Level 10]"],DwarfReq2,"DwarfUpgrade2",true)
  118. CreateClick(workspace["Dwarf Upgrade3 [60k Beli] [Level 15]"],DwarfReq3,"DwarfUpgrade3",true)
  119.  
  120. --Mink Race Upgrades
  121. local MinkReq1 = {["Gold"] = 35000,["LVL"] = 15,["Race"] = "Mink",["MinkUpgradee"] = false}
  122. local MinkReq2 = {["Gold"] = 60000,["LVL"] = 25,["Race"] = "Mink",["MinkUpgradee"] = true,["MinkUpgradee2"] = false}
  123.  
  124. CreateClick(workspace["Mink Upgrade [35k Beli] [Level 15]"],MinkReq1,"MinkUpgradee",true)
  125. CreateClick(workspace["Mink Upgrade 2 [60k Beli] [Level 25]"],MinkReq2,"MinkUpgradee2",true)
  126.  
  127. --Skypiean Race Upgrades
  128. local SkypieanReq1 = {["Gold"] = 20000,["LVL"] = 5,["Race"] = "Skypiean",["SkypieanUpgrade"] = false}
  129. local SkypieanReq2 = {["Gold"] = 30000,["LVL"] = 10,["Race"] = "Skypiean",["SkypieanUpgrade"] = true,["SkypieanUpgrade2"] = false}
  130. local SkypieanReq3 = {["Gold"] = 60000,["LVL"] = 15,["Race"] = "Skypiean",["SkypieanUpgrade"] = true,["SkypieanUpgrade2"] = true,["SkypieanUpgrade3"] = false}
  131.  
  132. CreateClick(workspace["Skypiean Upgrade [20k Beli] [Level 5]"],SkypieanReq1,"SkypieanUpgrade",true)
  133. CreateClick(workspace["Skypiean Upgrade2 [30k Beli] [Level 10]"],SkypieanReq2,"SkypieanUpgrade2",true)
  134. CreateClick(workspace["Skypiean Upgrade3 [60k Beli] [Level 15]"],SkypieanReq3,"SkypieanUpgrade3",true)
Add Comment
Please, Sign In to add comment