Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ds=game:GetService("DataStoreService"):GetDataStore("Limiteds")
- local dr=game:GetService("DataStoreService"):GetDataStore("CaseBux")
- local u=game:GetService("DataStoreService"):GetDataStore("Upgrades")
- local codes=game:GetService("DataStoreService"):GetDataStore("Codes")
- local bux={
- ['51401076']=1000;
- ['51358496']=10000;
- ['51401103']=25000;
- ['51401121']=50000;
- ['51401137']=75000;
- ['51401148']=100000;
- ['51401163']=250000;
- ['51401176']=500000;
- ['51401193']=750000;
- ['51401204']=1000000;
- };
- function Count(player,item,place)
- local a=0;
- for i,v in next,player[place]:GetChildren() do
- if v.Name==item then
- a=a+1
- end
- end
- return a;
- end
- function GetRap(v)
- return workspace.Limiteds:FindFirstChild(v) and workspace.Limiteds[v].Value or 100000;
- end
- local function GetDescendants(parent)
- local Children, Index = parent:GetChildren(), 1 -- set the initial frame
- local Stack, All = {}, {}
- while true do
- local Child = Children[Index]
- if Child then -- more children to get, hooray!
- table.insert(All, Child) -- push the child onto the array
- table.insert(Stack, {Children, Index}) -- push the current frame onto the stack
- Children, Index = Child:GetChildren(), 0 -- create a new frame from the child's children
- else -- no more children
- if #Stack > 0 then
- local Frame = table.remove(Stack) -- get the last frame off the top of the stack
- Children, Index = Frame[1], Frame[2] -- set Children and Index to the previous frame's values
- else
- break -- stack is empty, we are at the top level, time to exit
- end
- end
- Index = Index + 1 -- increment the index
- end
- return All
- end
- function Update(player)
- spawn(function()
- local amount=player:WaitForChild("TotalValue").Value-game:GetService("PointsService"):GetGamePointBalance(player.userId)
- if amount~=0 and player.userId>0 then
- game:GetService("PointsService"):AwardPoints(player.userId,amount)
- end
- end)
- repeat wait() until player.Character
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("Accessory") or v:IsA("Tool") then
- v:Destroy()
- end
- end
- for i,v in next,player.Items:GetChildren() do
- if v.Value then
- local t=game:GetService("InsertService"):LoadAsset(tonumber(v.Name)):GetChildren()[1]
- if t:IsA("Decal") then
- player.Character.Head.face.Texture=t.Texture
- else
- if t:IsA("Tool") then
- for _,x in next,GetDescendants(t) do
- if x:IsA("Script") or x:IsA("LocalScript") or x:IsA("GuiObject") then
- x:Destroy()
- end
- end
- end
- t.Parent=player.Character
- end
- end
- end
- if player.TotalValue.Value>=100000000 then
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Yellow()
- v.Material=Enum.Material.Neon
- end
- end
- elseif player.TotalValue.Value>=50000000 then
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Red()
- v.Material=Enum.Material.Neon
- end
- end
- elseif player.TotalValue.Value>=10000000 then
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Green()
- v.Material=Enum.Material.Neon
- end
- end
- elseif player.TotalValue.Value>=1000000 then
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Blue()
- v.Material=Enum.Material.Neon
- end
- end
- elseif player.TotalValue.Value>=100000 then
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Yellow()
- v.Material=Enum.Material.Foil
- end
- end
- elseif player.TotalValue.Value>=50000 then
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Red()
- v.Material=Enum.Material.Slate
- end
- end
- elseif player.TotalValue.Value>=10000 then
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Green()
- v.Material=Enum.Material.Grass
- end
- end
- else
- for i,v in next,player.Character:GetChildren() do
- if v:IsA("BasePart") then
- v.BrickColor=BrickColor.Blue()
- v.Material=Enum.Material.Plastic
- end
- end
- end
- end
- game:GetService("MarketplaceService").ProcessReceipt=(function(info)
- if info.ProductId==51400901 then
- for _,player in next,game.Players:GetPlayers() do
- if player.userId==info.PlayerId then
- local t={}
- for i=1,100 do
- local number=math.random()+(player.CaseOdds.Value*0.01)
- local rand;
- if number<=0.5 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=10000 and rand.Value<50000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000)
- elseif number<=0.75 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=50000 and rand.Value<100000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000)
- else
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=100000 and rand.Value~=100000
- end
- table.insert(t,rand)
- end
- local chosen=math.random(30,90)
- Instance.new("BoolValue",player.Items).Name=t[chosen].Name
- workspace.OpenCase:FireClient(player,t,chosen)
- return Enum.ProductPurchaseDecision.PurchaseGranted
- end
- end
- elseif bux[tostring(info.ProductId)] then
- for i,v in next,game.Players:GetPlayers() do
- if v.userId==info.PlayerId then
- v:WaitForChild("Robux").Value=v.Robux.Value+bux[tostring(info.ProductId)]
- return Enum.ProductPurchaseDecision.PurchaseGranted
- end
- end
- end
- end)
- spawn(function()
- while wait(60) do
- for i,player in next,game.Players:GetPlayers() do
- if player:FindFirstChild("Robux") and player:FindFirstChild("Items") and player:WaitForChild("Loaded").Value then
- if game:GetService("BadgeService"):UserHasBadge(player.userId,687032973) then
- player.Robux.Value=player.Robux.Value+10000
- end
- local success;
- repeat success=pcall(function()
- dr:SetAsync(tostring(player.userId),player.Robux.Value)
- end) until success
- repeat success=pcall(function()
- local t={}
- for i,v in next,player.Items:GetChildren() do
- table.insert(t,v.Name)
- end
- ds:SetAsync(tostring(player.userId),t);
- end) until success
- repeat success=pcall(function()
- local t={}
- t[1]=player.Click.Value
- t[2]=player.CaseOdds.Value
- t[3]=player.Tester.Value
- u:SetAsync(tostring(player.userId),t);
- end) until success
- repeat success=pcall(function()
- local t={}
- for i,v in next,player.Codes:GetChildren() do
- table.insert(t,v.Name)
- end
- codes:SetAsync(tostring(player.userId),t);
- end) until success
- end
- end
- end
- end)
- game.Players.PlayerAdded:connect(function(player)
- player.CanLoadCharacterAppearance=false
- Instance.new("BoolValue",player).Name='Unobtainable'
- player.Unobtainable.Value=game:GetService("BadgeService"):UserHasBadge(player.userId,688165577)
- if player.userId==game.CreatorId then
- player.Unobtainable.Value=false
- end
- Instance.new("IntValue",player).Name='Robux'
- Instance.new("IntValue",player).Name='Items'
- Instance.new("IntValue",player).Name='TotalValue'
- Instance.new("NumberValue",player).Name='DontExploit'
- Instance.new("BoolValue",player).Name='Loaded'
- Instance.new("StringValue",player).Name='Trade'
- Instance.new("BoolValue",player).Name='Busy'
- Instance.new("BoolValue",player).Name='Accept'
- Instance.new("BoolValue",player).Name='Case'
- Instance.new("IntValue",player).Name='Click'
- Instance.new("IntValue",player).Name='Codes'
- Instance.new("IntValue",player).Name='CaseOdds'
- Instance.new("BoolValue",player).Name='Tester'
- local upgrades=u:GetAsync(tostring(player.userId))
- player.Click.Value=upgrades and type(upgrades)=='table' and upgrades[1] or 25
- player.CaseOdds.Value=upgrades and type(upgrades)=='table' and upgrades[2] or 0
- player.Tester.Value=upgrades and type(upgrades)=='table' and upgrades[3] or false
- player.Case.Value=true
- player.Robux.Value=dr:GetAsync(tostring(player.userId)) or 10000
- player.CharacterAdded:connect(function(char)
- Update(player)
- player.Busy.Value=false
- player.Accept.Value=false
- for i,v in next,player.Trade:GetChildren() do
- v:Destroy()
- end
- end)
- player.Items.ChildAdded:connect(function(item)
- wait()
- if not workspace.Limiteds:FindFirstChild(item.Name) or (workspace.Limiteds:FindFirstChild(item.Name).Value==100000) then
- local rap=GetRap(item.Name)
- local t=Instance.new("IntValue",workspace.Limiteds)
- t.Name=item.Name
- t.Value=rap
- end
- item.Changed:connect(function()
- Update(player)
- end)
- end)
- player.Items.ChildRemoved:connect(function()
- Update(player)
- end)
- local loaded_data=ds:GetAsync(tostring(player.userId))
- if loaded_data and type(loaded_data)=='table' then
- for i,v in next,loaded_data do
- if tonumber(v) then
- Instance.new("BoolValue",player.Items).Name=v
- if not workspace.Limiteds:FindFirstChild(v) then
- local newval=GetRap(v)
- local new=Instance.new("IntValue",workspace.Limiteds)
- new.Name=v
- new.Value=newval
- end
- end
- end
- end
- local loaded_data=codes:GetAsync(tostring(player.userId))
- if loaded_data and type(loaded_data)=='table' then
- for i,v in next,loaded_data do
- Instance.new("BoolValue",player.Codes).Name=v
- end
- end
- if not player.Tester.Value and game:GetService("DataStoreService"):GetDataStore("Robux"):GetAsync(tostring(player.userId)) and game:GetService("DataStoreService"):GetDataStore("Robux"):GetAsync(tostring(player.userId))~=0 then
- player.Tester.Value=true
- game:GetService("DataStoreService"):GetDataStore("Robux"):SetAsync(tostring(player.userId),0)
- Instance.new("BoolValue",player.Items).Name=89171071
- end
- player.Loaded.Value=true
- if player.Character then
- player:LoadCharacter()
- end
- end)
- game.Players.PlayerRemoving:connect(function(player)
- if player:WaitForChild("Loaded").Value then
- dr:SetAsync(tostring(player.userId),player:WaitForChild("Robux").Value)
- local t={}
- for i,v in next,player.Items:GetChildren() do
- table.insert(t,v.Name)
- end
- ds:SetAsync(tostring(player.userId),t);
- repeat success=pcall(function()
- local t={}
- t[1]=player.Click.Value
- t[2]=player.CaseOdds.Value
- t[3]=player.Tester.Value
- u:SetAsync(tostring(player.userId),t);
- end) until success
- repeat success=pcall(function()
- local t={}
- for i,v in next,player.Codes:GetChildren() do
- table.insert(t,v.Name)
- end
- codes:SetAsync(tostring(player.userId),t);
- end) until success
- end
- end)
- workspace.CompleteTrade.OnServerEvent:connect(function(player,other)
- if player and other and player.Parent and other.Parent and player.Accept.Value and other.Accept.Value and player.Loaded.Value and other.Loaded.Value then
- for i,v in next,player.Trade:GetChildren() do
- if player.Items:FindFirstChild(v.Name) then
- v.Value=false
- v.Parent=other.Items
- player.Items[v.Name]:Destroy()
- end
- end
- for i,v in next,other.Trade:GetChildren() do
- if other.Items:FindFirstChild(v.Name) then
- v.Value=false
- v.Parent=player.Items
- other.Items[v.Name]:Destroy()
- end
- end
- end
- player.Trade:ClearAllChildren()
- other.Trade:ClearAllChildren()
- player.Accept.Value=false
- other.Accept.Value=false
- player.Busy.Value=false
- other.Busy.Value=false
- end)
- workspace.SendTrade.OnServerEvent:connect(function(sender,other)
- if not sender.Busy.Value and not other.Busy.Value and sender.Loaded.Value and other.Loaded.Value then
- sender.Busy.Value=true
- other.Busy.Value=true
- workspace.SendTrade:FireClient(sender,sender,other)
- workspace.SendTrade:FireClient(other,sender,other)
- end
- end)
- workspace.StartTrade.OnServerEvent:connect(function(player1,player2)
- if player1.Loaded.Value and player2.Loaded.Value then
- player1.Accept.Value=false
- player2.Accept.Value=false
- workspace.StartTrade:FireClient(player1,player2)
- workspace.StartTrade:FireClient(player2,player1)
- end
- end)
- workspace.AddToTrade.OnServerEvent:connect(function(player,item,bool)
- if bool and player.Items:FindFirstChild(item) and player.Loaded.Value and Count(player,item,'Trade')<Count(player,item,'Items') then
- player.Items[item]:Clone().Parent=player.Trade
- elseif not bool and player.Trade:FindFirstChild(item) then
- player.Trade[item]:Destroy()
- end
- end)
- workspace.TradeDecision.OnServerEvent:connect(function(player,bool,other)
- if bool then
- player.Accept.Value=true
- elseif other then
- player.Accept.Value=false
- other.Accept.Value=false
- else
- player.Busy.Value=false
- end
- end)
- workspace.GiveRobux.OnServerEvent:connect(function(player,item)
- if item and item=='Click' then
- if player.Robux.Value>=player.Click.Value*1000 then
- player.Robux.Value=player.Robux.Value-player.Click.Value*1000
- player.Click.Value=player.Click.Value+5
- end
- elseif item and item=='Case' then
- if player.Robux.Value>=(player.CaseOdds.Value+1)*100000 and player.CaseOdds.Value<50 then
- player.Robux.Value=player.Robux.Value-(player.CaseOdds.Value+1)*100000
- player.CaseOdds.Value=player.CaseOdds.Value+1
- end
- elseif item then
- if player.Items:FindFirstChild(item) then
- player:WaitForChild("Robux").Value=player.Robux.Value+workspace.Limiteds[item].Value
- player.Items[item]:Destroy()
- end
- else
- if player.DontExploit.Value<13 then
- player.DontExploit.Value=player.DontExploit.Value+1
- player:WaitForChild("Robux").Value=player.Robux.Value+player:WaitForChild("Click").Value
- else player:Kick('You have been kicked for auto clicking. This is your warning!');
- end
- end
- end)
- spawn(function()
- while wait(1) do
- for i,v in next,game.Players:GetPlayers() do
- if v:FindFirstChild("DontExploit") then
- v.DontExploit.Value=0
- end
- end
- end
- end)
- workspace.EquipItem.OnServerEvent:connect(function(player,item)
- local val=player.Items:WaitForChild(item).Value
- if game:GetService("InsertService"):LoadAsset(tonumber(item)):GetChildren()[1]:IsA("Decal") then
- for i,v in next,player.Items:GetChildren() do
- if v.Value and game:GetService("InsertService"):LoadAsset(tonumber(v.Name)):GetChildren()[1]:IsA("Decal") then
- v.Value=false
- end
- end
- elseif game:GetService("InsertService"):LoadAsset(tonumber(item)):GetChildren()[1]:IsA("Tool") then
- for i,v in next,player.Items:GetChildren() do
- if v.Value and game:GetService("InsertService"):LoadAsset(tonumber(v.Name)):GetChildren()[1]:IsA("Tool") then
- v.Value=false
- end
- end
- end
- player.Items[item].Value=not val
- if not player.Items[item].Value and game:GetService("InsertService"):LoadAsset(tonumber(item)):GetChildren()[1]:IsA("Decal") then
- player.Character.Head.face.Texture='rbxasset://textures/face.png'
- end
- end)
- local codes={
- ['DOMINOSAREWHITE']=702899078;
- ['CODESLOL']=702898507;
- ['sAmUeLkInGxIsThEbEsTpLeAsEdOnTpUtThIsCoDeIn1']=695402043;
- ['sAmUeLkInGxIsThEbEsTpLeAsEdOnTpUtThIsCoDeIn2']=695400614;
- }
- local code_ids={}
- for i,v in next,codes do
- code_ids[tostring(v)]=true
- end
- workspace.FireCode.OnServerEvent:connect(function(player,code)
- if codes[code] and not player:WaitForChild("Codes"):FindFirstChild(code) then
- Instance.new("IntValue",player.Codes).Name=code
- Instance.new("BoolValue",player.Items).Name=codes[code]
- end
- end)
- local case_prices={
- ['Common']=2500;
- ['Uncommon']=5000;
- ['Rare']=15000;
- ['Epic']=40000;
- };
- workspace.OpenCase.OnServerEvent:connect(function(player,case_type)
- if player.Robux.Value>=case_prices[case_type] and player.Case.Value then
- player.Case.Value=false
- local t={}
- for i=1,100 do
- if math.random()>0.65 then wait() end
- local rand;
- repeat
- local number=math.random()+(player:WaitForChild("CaseOdds").Value*0.01)
- if case_type=='Common' then
- if number<=0.8 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value<10000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- else
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=10000 and rand.Value<50000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- end
- elseif case_type=='Uncommon' then
- if number<=0.7 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value<10000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- elseif number<=0.95 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=10000 and rand.Value<50000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- else
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=50000 and rand.Value<100000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- end
- elseif case_type=='Rare' then
- if number<=0.6 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value<10000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- elseif number<=0.75 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=10000 and rand.Value<50000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- elseif number<=0.9 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=50000 and rand.Value<100000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- else
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=100000 and rand.Value<=500000 and rand.Value~=100000
- end
- elseif case_type=='Epic' then
- if number<=0.5 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value<10000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- elseif number<=0.65 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=10000 and rand.Value<50000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- elseif number<=0.85 then
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=50000 and rand.Value<100000 and rand.Value~=100000 or (player.Unobtainable.Value and rand.Value==100000 )
- else
- repeat rand=workspace.Limiteds:GetChildren()[math.random(#workspace.Limiteds:GetChildren())] until rand.Value>=100000 and rand.Value~=100000
- end
- end
- until rand and not code_ids[tostring(rand.Name)] and (rand.Value~=100000 or math.random()>0.5) and rand.Name~='89171071'
- table.insert(t,rand)
- end
- local chosen=math.random(30,90)
- Instance.new("BoolValue",player:WaitForChild("Items")).Name=t[chosen].Name
- player.Robux.Value=player.Robux.Value-case_prices[case_type]
- workspace.OpenCase:FireClient(player,t,chosen)
- wait(1)
- player.Case.Value=true
- end
- end)
- local l=Instance.new("BoolValue",workspace)
- l.Name='Limiteds'
- l.ChildAdded:connect(function(thing)
- wait(1)
- if thing.Value==0 then
- thing.Value=100000
- end
- end)
- local u={1114768;6128663;1078202;4640898;10468797;76059498;76382978;42070576}
- for i,v in next,u do
- local val=Instance.new("IntValue",l)
- val.Name=v
- val.Value=100000
- end
- local info=require(game.ServerStorage.JSON)
- local decoded=game:GetService("HttpService"):JSONDecode(info)
- for i,v in next,decoded do
- if not workspace.Limiteds:FindFirstChild(v.AssetId) then
- local t=Instance.new("IntValue",l)
- t.Name=v.AssetId
- t.Value=(v.AveragePrice>0 and v.AveragePrice or 100000)
- else workspace.Limiteds[v.AssetId].Value=(v.AveragePrice>0 and v.AveragePrice or 100000)
- end
- if math.random()>0.7 then wait() end
- end
- l.Value=true
Advertisement
Add Comment
Please, Sign In to add comment