Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local event = game.ReplicatedStorage:WaitForChild("KeyBind")
- function event:OnServerInvoke(Player, tier,key)
- local suffixes = {'','K','M','B','T','qd','Qn','sx','Sp','O','N','de','Ud','DD','tdD','qdD','QnD','sxD','SpD','OcD','NvD','Vgn','UVg','DVg','TVg','qtV','QnV','SeV','SPG','OVG','NVG','TGN','UTG','DTG','tsTG','qtTG','QnTG','ssTG','SpTG','OcTG','NoAG','UnAG','DuAG','TeAG','QdAG','QnAG','SxAG','SpAG','OcAG','NvAG','CT'}
- local function format(val)
- for i=1, #suffixes do
- if tonumber(val) < 10^(i*3) then
- return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]
- end
- end
- end
- local id = 6172708 --// GAMEPASS ID, + 30 SLOTS
- local TS = game:GetService("TweenService")
- local RS = game:GetService("ReplicatedStorage")
- local Library = RS:WaitForChild("View")
- local Eggs = require(RS:WaitForChild("Eggs"))
- local Data = Eggs[tostring(tier)]
- local module = require(game.ReplicatedStorage:WaitForChild("PETS"))
- local Cost = Data["Cost"]
- local Pets = Data["Pets"]
- local Tier = script.Parent:WaitForChild(tostring(tier))
- local Egg = Tier:WaitForChild("Egg")
- local TotalWeight = 0
- for i,v in pairs(Pets) do
- TotalWeight = TotalWeight + v[1]
- end
- local function RotateTween(Obj,Rot)
- local TI = TweenInfo.new(.1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
- local Propertiers = {
- Rotation = Rot
- }
- local Tween = TS:Create(Obj,TI,Propertiers)
- Tween:Play()
- end
- local function ChoosePet(Player)
- local Chance = math.random(1,TotalWeight)
- local Counter = 0
- for i,v in pairs(Pets) do
- Counter = Counter+v[1]
- if Chance <= Counter then
- return i
- end
- end
- end
- if key == true then
- local Stats = Player:WaitForChild("leaderstats")
- local Coins = Stats:WaitForChild("Coins")
- local PetInv = Player:WaitForChild("Pets")
- local IndexInv = Player:WaitForChild("Index")
- if Player:FindFirstChild("DebPet") then return end
- local Counter = 0
- for i,v in pairs(PetInv:GetChildren()) do
- Counter=Counter+v.Value
- end
- if Coins.Value >= Cost*3 then
- if Counter >= 50 and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
- local GUI = Instance.new("ScreenGui")
- local PN = script:WaitForChild("Full"):Clone()
- PN.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(2)
- GUI:Destroy()
- elseif Counter >= 20 and not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
- local GUI = Instance.new("ScreenGui")
- local PN = script:WaitForChild("Full"):Clone()
- PN.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(2)
- GUI:Destroy()
- elseif Counter <= 17 and not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) or Counter <= 47 and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
- local debounce = Instance.new("BoolValue")
- debounce.Name = "DebPet"
- debounce.Parent = Player
- Coins.Value = Coins.Value - Cost*3
- local PetChosen1,PetChosen2,PetChosen3 = ChoosePet(Player),ChoosePet(Player),ChoosePet(Player)
- local GUI = Instance.new("ScreenGui")
- local ViewPort1,ViewPort2,ViewPort3 = Instance.new("ViewportFrame"),Instance.new("ViewportFrame"),Instance.new("ViewportFrame")
- local PetInv = Player:WaitForChild("Pets")
- PetInv:WaitForChild(PetChosen1).Value = PetInv:WaitForChild(PetChosen1).Value +1 IndexInv:WaitForChild(PetChosen1).Value = true
- PetInv:WaitForChild(PetChosen2).Value = PetInv:WaitForChild(PetChosen2).Value +1 IndexInv:WaitForChild(PetChosen2).Value = true
- PetInv:WaitForChild(PetChosen3).Value = PetInv:WaitForChild(PetChosen3).Value +1 IndexInv:WaitForChild(PetChosen3).Value = true
- ViewPort1.Size = UDim2.new(0,260,0,354)ViewPort2.Size = UDim2.new(0,282,0,354)ViewPort3.Size = UDim2.new(0,260,0,354)
- ViewPort1.Position,ViewPort2.Position = UDim2.new(0.333,0,0,0),UDim2.new(0.653,0,0,0)
- ViewPort1.BackgroundTransparency = 1 ViewPort2.BackgroundTransparency = 1 ViewPort3.BackgroundTransparency = 1
- local EggClone1,EggClone2,EggClone3 = Egg:Clone(),Egg:Clone(),Egg:Clone()
- local Pos1,Pos2,Pos3 = EggClone1.Position,EggClone2.Position,EggClone3.Position
- EggClone1.Parent,EggClone2.Parent,EggClone3.Parent = ViewPort1,ViewPort2,ViewPort3
- local Camera1,Camera2,Camera3 = Instance.new("Camera"),Instance.new("Camera"),Instance.new("Camera")
- Camera1.Parent,Camera2.Parent,Camera3.Parent = ViewPort1,ViewPort2,ViewPort3
- ViewPort1.CurrentCamera,ViewPort2.CurrentCamera,ViewPort3.CurrentCamera = Camera1,Camera2,Camera3
- Camera1.CFrame,Camera2.CFrame,Camera3.CFrame = CFrame.new(Vector3.new(Pos1.X,Pos1.Y,Pos1.Z+7),Pos1),CFrame.new(Vector3.new(Pos2.X,Pos2.Y,Pos2.Z+7),Pos2),CFrame.new(Vector3.new(Pos3.X,Pos3.Y,Pos3.Z+7),Pos3)
- local pn1,pn2,pn3 = script:WaitForChild("Effect"):Clone(),script:WaitForChild("Effect"):Clone(),script:WaitForChild("Effect"):Clone()
- local module = require(game.ReplicatedStorage:WaitForChild("PETS"))
- local nm1,nm2,nm3 = script:WaitForChild("NOME"):Clone(),script:WaitForChild("NOME"):Clone(),script:WaitForChild("NOME"):Clone()
- nm1.Text,nm2.Text,nm3.Text = module.Pets[tonumber(PetChosen1)],module.Pets[tonumber(PetChosen2)],module.Pets[tonumber(PetChosen3)]
- ViewPort1.Parent = GUI ViewPort2.Parent = GUI ViewPort3.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(1)
- for i=1,5 do
- RotateTween(ViewPort1,25)
- RotateTween(ViewPort2,25)
- RotateTween(ViewPort3,25)
- wait(.1)
- RotateTween(ViewPort1,-25)
- RotateTween(ViewPort2,-25)
- RotateTween(ViewPort3,-25)
- wait(.1)
- end
- RotateTween(ViewPort1,0)
- RotateTween(ViewPort2,0)
- RotateTween(ViewPort3,0)
- wait(.5)
- EggClone1:Destroy() EggClone2:Destroy() EggClone3:Destroy()
- nm1.Parent,nm2.Parent,nm3.Parent = ViewPort1,ViewPort2,ViewPort3
- pn1.Parent,pn2.Parent,pn3.Parent = ViewPort1,ViewPort2,ViewPort3
- local PetClone1,PetClone2,PetClone3 = Library:WaitForChild(PetChosen1):Clone(),Library:WaitForChild(PetChosen2):Clone(),Library:WaitForChild(PetChosen3):Clone()
- local HeadPos1,HeadPos2,HeadPos3 = PetClone1.Position,PetClone2.Position,PetClone3.Position
- Camera1.CFrame = CFrame.new(Vector3.new(HeadPos1.X,HeadPos1.Y,HeadPos1.Z+7),HeadPos1) Camera2.CFrame = CFrame.new(Vector3.new(HeadPos2.X,HeadPos2.Y,HeadPos2.Z+7),HeadPos2) Camera3.CFrame = CFrame.new(Vector3.new(HeadPos3.X,HeadPos3.Y,HeadPos3.Z+7),HeadPos3)
- PetClone1.Parent,PetClone2.Parent,PetClone3.Parent = ViewPort1,ViewPort2,ViewPort3
- wait(2)
- GUI:Destroy()
- debounce:Destroy()
- else
- local GUI = Instance.new("ScreenGui")
- local PN = script:WaitForChild("3pet"):Clone()
- PN.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(2)
- GUI:Destroy()
- end
- else
- local GUI = Instance.new("ScreenGui")
- local PN = script:WaitForChild("NoCoins"):Clone()
- PN.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(2)
- GUI:Destroy()
- end
- else
- local Stats = Player:WaitForChild("leaderstats")
- local Coins = Stats:WaitForChild("Coins")
- local IndexInv = Player:WaitForChild("Index")
- local PetInv = Player:WaitForChild("Pets")
- if Player:FindFirstChild("DebPet") then return end
- local Counter = 0
- for i,v in pairs(PetInv:GetChildren()) do
- Counter=Counter+v.Value
- end
- if Coins.Value >= Cost then
- if Counter >= 50 and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
- local GUI = Instance.new("ScreenGui")
- local PN = script:WaitForChild("Full"):Clone()
- PN.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(2)
- GUI:Destroy()
- elseif Counter >= 20 and not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
- local GUI = Instance.new("ScreenGui")
- local PN = script:WaitForChild("Full"):Clone()
- PN.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(2)
- GUI:Destroy()
- else
- local debounce = Instance.new("BoolValue")
- debounce.Name = "DebPet"
- debounce.Parent = Player
- Coins.Value = Coins.Value - Cost
- local PetChosen = ChoosePet(Player)
- local GUI = Instance.new("ScreenGui")
- local ViewPort = Instance.new("ViewportFrame")
- local PetInv = Player:WaitForChild("Pets")
- PetInv:WaitForChild(PetChosen).Value = PetInv:WaitForChild(PetChosen).Value +1 IndexInv:WaitForChild(PetChosen).Value = true
- ViewPort.Size = UDim2.new(1,0,1,0)
- ViewPort.BackgroundTransparency = 1
- local EggClone = Egg:Clone()
- local Pos = EggClone.Position
- EggClone.Parent = ViewPort
- local Camera = Instance.new("Camera")
- Camera.Parent = ViewPort
- ViewPort.CurrentCamera = Camera
- Camera.CFrame = CFrame.new(Vector3.new(Pos.X,Pos.Y,Pos.Z+7),Pos)
- local pn = script:WaitForChild("Effect"):Clone()
- local module = require(game.ReplicatedStorage:WaitForChild("PETS"))
- local nm = script:WaitForChild("NOME"):Clone()
- nm.Text = module.Pets[tonumber(PetChosen)]
- ViewPort.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(1)
- for i=1,5 do
- RotateTween(ViewPort,25)
- wait(.1)
- RotateTween(ViewPort,-25)
- wait(.1)
- end
- RotateTween(ViewPort,0)
- wait(.5)
- EggClone:Destroy()
- nm.Parent = GUI
- pn.Visible = true
- pn.Parent = ViewPort
- local PetClone = Library:WaitForChild(PetChosen):Clone()
- local HeadPos = PetClone.Position
- Camera.CFrame = CFrame.new(Vector3.new(HeadPos.X,HeadPos.Y,HeadPos.Z+7),HeadPos)
- PetClone.Parent = ViewPort
- wait(2)
- GUI:Destroy()
- debounce:Destroy()
- end
- else
- local GUI = Instance.new("ScreenGui")
- local PN = script:WaitForChild("NoCoins"):Clone()
- PN.Parent = GUI
- GUI.Parent = Player:WaitForChild("PlayerGui")
- wait(2)
- GUI:Destroy()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement