Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Local Script
- -- Made by qsenko29
- local RS = game:GetService("ReplicatedStorage") -- the actual Service in what we have all the Pets,Events stored and etc.
- local PetsFolder = RS.Pets
- local PetsPurchaseEvent = PetsFolder.PetEvents.PetsPurchase
- local PetsGamepassEvent = PetsFolder.PetEvents.PetGamepass
- local HiddenPetEvent = PetsFolder.PetEvents.HiddenPetEvent
- local MainFrame = script.Parent -- the frame that we will use to loop and get all objects,("instances") from!!!
- local debounce = true -- debounce is not recommended it can be just debounce that means its either true or false but i love setting it to something!!
- local player = game:GetService("Players").LocalPlayer -- thats a easy way of getting the local Player
- local PetValues = player.PetsFolder.Values:GetDescendants() --:GetChildren()
- local BuyFrame = player.PlayerGui:WaitForChild("PetsPurchaseGui").BuyPet
- local BuyButton = player.PlayerGui:WaitForChild("PetsPurchaseGui").BuyPet.Buy
- local CancelButton = player.PlayerGui:WaitForChild("PetsPurchaseGui").BuyPet.Close
- local Pets = PetsFolder.ActualPets:GetChildren()
- local button1 -- gonna disconnect them later:P
- local button2
- local button3
- --local previouspet = player.Character:FindFirstChild("Turtle") or player.Character:FindFirstChild("Bunny") or player.Character:FindFirstChild("Parrot") or player.Character:FindFirstChild("Piggy Bank") or player.Character:FindFirstChild("Mr.Crab") or player.Character:FindFirstChild("Puffer Fish") or player.Character:FindFirstChild("Hedgehog") or player.Character:FindFirstChild("CrocodilePal") or player.Character:FindFirstChild("King Frog") or player.Character:FindFirstChild("Kitty") or player.Character:FindFirstChild("Epic Duck") or player.Character:FindFirstChild("Octopus") or player.Character:FindFirstChild("Pet Rock") or player.Character:FindFirstChild("Sea Monster") or player.Character:FindFirstChild("Pikachu") or player.Character:FindFirstChild("OOF Spider") or player.Character:FindFirstChild("Pet Gojira") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Hungry Shark") or player.Character:FindFirstChild("Annoying Orange") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Bird") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Dragon") or player.Character:FindFirstChild("DragonTest") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Eye of Cthulhu")
- --print(Pets)
- for i,v in pairs(MainFrame:GetDescendants())do
- if v:IsA("ImageButton") and v.Name == "PetsButton" then
- for i,p in ipairs(PetValues)do
- button1 = v.MouseButton1Down:Connect(function(pet)
- local function RunTest()
- if p:IsA("BoolValue") and v:FindFirstChild("PetIndex").Value and v:FindFirstChild("PetIndex").Value == p.Name then -- p.Name ==
- if debounce and player then
- debounce = false
- --local PetIsName = v:FindFirstChild("PetIndex").Value
- if p.Value == false and v:FindFirstChild("PetIndex").Value and v:FindFirstChild("PetIndex").Value == p.Name and player.leaderstats.Coins.Value >= v.Price.Value then --and v:FindFirstChild("PetIndex").Value == p.Name-- and p[PetIsName] and p.Name == PetIsName
- local Frame = player:FindFirstChild("PlayerGui"):FindFirstChild("PetsPurchaseGui"):FindFirstChild("BuyPet")
- local FrameInfo = Frame:FindFirstChild("Desc")
- local PetName = v:FindFirstChild("PetIndex").Value
- local PetPrice = v:FindFirstChild("Price").Value
- -- print(v:FindFirstChild("PetIndex").Value .. " v - first if statement")
- -- print(p.Name .. " p.Name - 1st if statement")
- -- print(p.Value)
- FrameInfo.Text = "Are you Sure you want to buy this " .. PetName .. " for " .. PetPrice .. " Coins"
- Frame:TweenPosition(
- UDim2.new(0.499, 0,0.494, 0),-- End Position
- "Out", -- Easing Direction
- "Linear", -- Easing Style
- .5 -- Time in Seconds
- )
- Frame.Visible = true
- wait(.5)
- -- local thisbutton = v
- -- local newfunction = RunTest(thisbutton)
- -- local something = "hi"
- --BuyButton.MouseButton1Down:Connect(function(PetName,PetPrice)
- button2 = BuyButton.MouseButton1Down:Connect(function()
- -- damn it works!!!
- if debounce == false then
- --debounce = false
- local PetName = v:FindFirstChild("PetIndex").Value -- you can comment this!!
- -- print(thisbutton)
- -- print(newfunction)
- --RunTest()
- -- print(PetName)
- --RunTest()
- -- print(PetPrice)
- -- print(RunTest())
- -- print(v:FindFirstChild("PetIndex").Value .. " v - first if statement")
- -- print(p.Name .. " p.Name - 1st if statement")
- -- print(p.Value)
- -- end)
- -- return PetName
- PetsPurchaseEvent:FireServer(p,PetPrice)
- BuyFrame:TweenPosition(
- UDim2.new(0.499, 0,-1, 0),-- End Position
- "Out", -- Easing Direction
- "Linear", -- Easing Style
- .5 -- Time in Seconds
- )
- wait(.5)
- for i,pets in pairs(Pets)do
- if pets:IsA("Model") then
- -- print(pets.Name)
- if p.Value == true then --not player.Character:FindFirstChild(pets.Name)
- if player.PetsFolder:FindFirstChild("PetNameCheck").Value == pets.Name and player.Character:FindFirstChild(pets.Name) then
- -- print("Pet was found in Character")
- v.PetPriceCheck.Text = "Equipped"
- for i,l in pairs(MainFrame:GetDescendants()) do
- if l:IsA("ImageButton") and l.Name == "PetsButton" then
- if l:FindFirstChild("PetIndex").Value ~= player.PetsFolder:FindFirstChild("PetNameCheck").Value and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= "" then -- and not v.Name
- if l:FindFirstChild("PetPriceCheck").Text == "Equipped" then
- l:FindFirstChild("PetPriceCheck").Text = "Owned"
- -- print("Name Change idk")
- end
- end
- end
- end
- break
- end
- if player.PetsFolder:FindFirstChild("PetNameCheck").Value == "" and not player.Character:FindFirstChild(pets.Name) then
- -- print("Pet was not found in Character")
- v.PetPriceCheck.Text = "Owned"
- break
- end
- end
- end
- end
- button2:Disconnect()
- debounce = true
- end
- end)
- -- debounce = true
- -- return PetName
- end
- if p.Value == false and v:FindFirstChild("PetIndex").Value and v:FindFirstChild("PetIndex").Value == p.Name and player.leaderstats.Coins.Value < v.Price.Value then -- and PetIsName
- v.PetPriceCheck.Text = "Not Enough Coins"
- wait(0.5)
- v.PetPriceCheck.Text = v.Price.Value .. " Coins" -- resets the price to its default per pet
- -- print(p.Name .. " p.Name - second if statement")
- -- print(v:FindFirstChild("PetIndex").Value .. " v - second if statement")
- -- print(p.Value)
- debounce = true
- end
- if p.Value == true then --and v:FindFirstChild("PetIndex").Value == p.Name and player.leaderstats.Coins.Value >= v.Price.Value or player.leaderstats.Coins.Value < v.Price.Value then
- -- print(p.Name .. " p.Name - Third if statement")
- -- print(v:FindFirstChild("PetIndex").Value .. " v - Third if statement")
- -- print(p.Value)
- --v.PetPriceCheck.Text = "Owned"
- PetsPurchaseEvent:FireServer(p)
- -- print("We own the pet firing remote event")
- for i,pets in pairs(Pets)do
- if pets:IsA("Model") then
- -- print(pets.Name)
- if p.Value == true then
- if v.PetPriceCheck.Text == "Equipped" and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= "" and player.PetsFolder:FindFirstChild("PetNameCheck").Value == v.PetIndex.Value then --pets.Name
- -- print("Pet was found in Character")
- v.PetPriceCheck.Text = "Owned" -- it was on Owned
- break
- end
- --[[ if v.PetPriceCheck.Text == "Equipped" and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= "" or player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= v.PetIndex.Value then --pets.Name
- print("Pet was found in Character")
- v.PetPriceCheck.Text = "Equipped" -- it was on Owned
- -- we might need a loop in here
- break
- end--]]
- if v.PetPriceCheck.Text == "Owned" and player.PetsFolder:FindFirstChild("PetNameCheck").Value == "" or player.PetsFolder:FindFirstChild("PetNameCheck").Value == v.PetIndex.Value then
- -- print("Pet was not found in Character")
- v.PetPriceCheck.Text = "Equipped"
- break
- end
- if v.PetPriceCheck.Text == "Owned" and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= "" or player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= v.PetIndex.Value then
- -- print("Second Remove")
- -- print(v.Name)
- v.PetPriceCheck.Text = "Equipped"
- wait(.1)
- for i,z in pairs(MainFrame:GetDescendants()) do
- if z:IsA("ImageButton") and z.Name == "PetsButton" then
- if z:FindFirstChild("PetIndex").Value ~= player.PetsFolder:FindFirstChild("PetNameCheck").Value then
- if z.PetPriceCheck.Text == "Equipped" and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= z:FindFirstChild("PetIndex").Value then
- z.PetPriceCheck.Text = "Owned"
- end
- end
- end
- end
- wait()
- --[[for i,l in pairs(MainFrame:GetDescendants()) do
- if l:IsA("ImageButton") and l.Name == "PetsButton" then
- if l:FindFirstChild("PetIndex").Value ~= player.PetsFolder:FindFirstChild("PetNameCheck").Value and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= "" then -- and not v.Name
- if l:FindFirstChild("PetPriceCheck").Text == "Equipped" then
- l:FindFirstChild("PetPriceCheck").Text = "Equipped"--Owned
- print("Name Change idk")
- --break
- end
- end
- end
- end--]]
- break
- end
- --[[ if v.PetPriceCheck.Text == "Equipped" and player.PetsFolder:FindFirstChild("PetNameCheck").Value == "" then
- print("Second Equip")
- v.PetPriceCheck.Text = "Equipped"
- for i,l in pairs(MainFrame:GetDescendants()) do
- if l:IsA("ImageButton") and l.Name == "PetsButton" then
- if l:FindFirstChild("PetIndex").Value ~= player.PetsFolder:FindFirstChild("PetNameCheck").Value then
- if l:FindFirstChild("PetPriceCheck").Text == "Equipped" then
- l:FindFirstChild("PetPriceCheck").Text = "Owned"
- print("Name Change idk")
- end
- end
- end
- end
- break
- end
- end
- end
- end --]]
- -- v.PetPriceCheck.Text = v.Price.Value .. " Coins"
- end
- end
- end
- debounce = true
- end
- -- debounce = true
- --print("Making sure you work")
- wait()
- --break
- end
- end
- end
- RunTest()
- button1:Disconnect()
- end)
- end
- end
- if v:IsA("ImageButton") and v.Name == "PetsGamepassButton" then -- gamepass experiment stuff
- --print("not my nigga") -- script will run when player is loaded basically the for loop:)
- button3 = v.MouseButton1Down:Connect(function()
- button3:Disconnect()
- if debounce and player then
- debounce = false
- -- print("not my nigga")
- local id = v:FindFirstChild("Gamepass Id").Value
- local Name = v:FindFirstChild("PetIndex").Value
- local TextPrice = v:FindFirstChild("PetPriceCheck").Text
- local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id)
- local success, errormessage = pcall(ownsGamepass);
- -- print(id)
- -- print(Name)
- if ownsGamepass then
- -- print("he owns it")
- PetsGamepassEvent:FireServer(id,Name)
- else
- -- print("he doesnt own the gamepass!!")
- PetsGamepassEvent:FireServer(id,Name)
- end
- debounce = true
- end
- end)
- end
- if v:IsA("ImageButton") and v.Name == "PetsHiddenButton" then -- hidden experiment stuff
- --print("not my nigga") -- script will run when player is loaded basically the for loop:)
- v.MouseButton1Down:Connect(function()
- if debounce and player then
- -- if stat bla bla = true then do this bam
- -- print("not my hidden nigga")
- end
- end)
- end
- end
- CancelButton.MouseButton1Down:Connect(function()
- if not debounce and player then
- --debounce = false
- BuyFrame:TweenPosition(
- UDim2.new(0.499, 0,-1, 0),-- End Position
- "Out", -- Easing Direction
- "Linear", -- Easing Style
- .5 -- Time in Seconds
- )
- wait(.5)
- button2:Disconnect()
- BuyFrame.Visible = false
- debounce = true
- end
- end)
- --Server Pethandles
- local DataStoreService = game:GetService("DataStoreService")
- local data = DataStoreService:GetDataStore("PetShop")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local MarketplaceService = game:GetService("MarketplaceService")
- local PetsFolder = ReplicatedStorage.Pets
- local PetsPurchaseEvent = PetsFolder.PetEvents.PetsPurchase
- local PetsGamepassEvent = PetsFolder.PetEvents.PetGamepass
- local Pets = PetsFolder.ActualPets:GetChildren()
- local Market
- local debounce = true
- game.Players.PlayerAdded:Connect(function(player)
- --Pets stuff
- local PetsFolder = Instance.new("Folder",player); PetsFolder.Name = "PetsFolder"
- local Pets = Instance.new("Folder",PetsFolder); Pets.Name = "Pets"
- local PetsValues = Instance.new("Folder",PetsFolder); PetsValues.Name = "Values"
- local PetNameCheck = Instance.new("StringValue",PetsFolder); PetNameCheck.Name = "PetNameCheck"
- --Pets Values
- local Turtle = Instance.new("BoolValue",PetsValues); Turtle.Name = "Turtle"
- local Bunny = Instance.new("BoolValue",PetsValues); Bunny.Name = "Bunny"
- local Parrot = Instance.new("BoolValue",PetsValues); Parrot.Name = "Parrot"
- local PiggyBank = Instance.new("BoolValue",PetsValues); PiggyBank.Name = "Piggy Bank"
- local MrCrab = Instance.new("BoolValue",PetsValues); MrCrab.Name = "Mr.Crab"
- local PufferFish = Instance.new("BoolValue",PetsValues); PufferFish.Name = "Puffer Fish"
- local Hedgehog = Instance.new("BoolValue",PetsValues); Hedgehog.Name = "Hedgehog"
- local CrocodilePal = Instance.new("BoolValue",PetsValues); CrocodilePal.Name = "CrocodilePal"
- local KingFrog = Instance.new("BoolValue",PetsValues); KingFrog.Name = "King Frog"
- local Kitty = Instance.new("BoolValue",PetsValues); Kitty.Name = "Kitty"
- local EpicDuck = Instance.new("BoolValue",PetsValues); EpicDuck.Name = "Epic Duck"
- local Octopus = Instance.new("BoolValue",PetsValues); Octopus.Name = "Octopus"
- local PetRock = Instance.new("BoolValue",PetsValues); PetRock.Name = "Pet Rock"
- local SeaMonster = Instance.new("BoolValue",PetsValues); SeaMonster.Name = "Sea Monster"
- local Pikachu = Instance.new("BoolValue",PetsValues); Pikachu.Name = "Pikachu"
- local OOFSpider = Instance.new("BoolValue",PetsValues); OOFSpider.Name = "OOF Spider"
- local PetGojira = Instance.new("BoolValue",PetsValues); PetGojira.Name = "Pet Gojira"
- local Scorpion = Instance.new("BoolValue",PetsValues); Scorpion.Name = "Scorpion"
- local HungryShark = Instance.new("BoolValue",PetsValues); HungryShark.Name = "Hungry Shark"
- local AnnoyingOrange = Instance.new("BoolValue",PetsValues); AnnoyingOrange.Name = "Annoying Orange"
- local EvilUnicorn = Instance.new("BoolValue",PetsValues); EvilUnicorn.Name = "Evil Unicorn"
- local ArcticReindeer = Instance.new("BoolValue",PetsValues); ArcticReindeer.Name = "Arctic Reindeer"
- local Bird = Instance.new("BoolValue",PetsValues); Bird.Name = "Bird"
- local GrayWolf = Instance.new("BoolValue",PetsValues); GrayWolf.Name = "Gray Wolf"
- local Dog = Instance.new("BoolValue",PetsValues); Dog.Name = "Dog"
- local Otter = Instance.new("BoolValue",PetsValues); Otter.Name = "Otter"
- local AlienBee = Instance.new("BoolValue",PetsValues); AlienBee.Name = "Alien Bee"
- local TRex = Instance.new("BoolValue",PetsValues); TRex.Name = "T-Rex"
- local Phoenix = Instance.new("BoolValue",PetsValues); Phoenix.Name = "Phoenix"
- local HellDragon = Instance.new("BoolValue",PetsValues); HellDragon.Name = "Hell Dragon"
- --Hidden Pet Value
- local HiddenPetValue = Instance.new("BoolValue",PetsValues); HiddenPetValue.Name = "Eye of Cthulhu"
- player.CharacterAdded:Connect(function(Character)
- local Pets = game:GetService("ReplicatedStorage").Pets.ActualPets:GetChildren()
- for i,pets in pairs(Pets) do
- if pets:IsA("Model") then
- if player.PetsFolder:FindFirstChild("PetNameCheck").Value == pets.Name then
- local pet = pets:Clone()
- pet.Parent = player.Character
- break
- end
- end
- end
- end)
- end)
- PetsPurchaseEvent.OnServerEvent:Connect(function(player,p,PetPrice)
- local previouspet = player.Character:FindFirstChild("Turtle") or player.Character:FindFirstChild("Bunny") or player.Character:FindFirstChild("Parrot") or player.Character:FindFirstChild("Piggy Bank") or player.Character:FindFirstChild("Mr.Crab") or player.Character:FindFirstChild("Puffer Fish") or player.Character:FindFirstChild("Hedgehog") or player.Character:FindFirstChild("CrocodilePal") or player.Character:FindFirstChild("King Frog") or player.Character:FindFirstChild("Kitty") or player.Character:FindFirstChild("Epic Duck") or player.Character:FindFirstChild("Octopus") or player.Character:FindFirstChild("Pet Rock") or player.Character:FindFirstChild("Sea Monster") or player.Character:FindFirstChild("Pikachu") or player.Character:FindFirstChild("OOF Spider") or player.Character:FindFirstChild("Pet Gojira") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Hungry Shark") or player.Character:FindFirstChild("Annoying Orange") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Bird") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Dragon") or player.Character:FindFirstChild("DragonTest") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Eye of Cthulhu")
- -- print("Received Server message")
- -- print(p)
- -- print(p.Name)
- local Values = player.PetsFolder.Values
- for i,v in pairs(Values:GetDescendants()) do
- if v:IsA("BoolValue") then
- --print(v.Name)
- --print(v.Name == p.Name)
- if v.Name == p.Name then
- -- print("To the Next Step")
- -- print(v.Name == p)
- -- print(v.Name)
- -- print(v.Value)
- if v.Value == true then
- -- print(v.Name.." Owned")
- for i,pets in pairs(Pets) do
- -- print(pets.Name)
- if pets:IsA("Model") and p.Name == pets.Name then
- -- print(pets.Name)
- ---- print(v.Name.." v.Name")
- -- print(p.Name.." p.Name")
- -- print(pets.Name.." pets.Name")
- --local previouspet = pets
- local previouspet = player.Character:FindFirstChild("Turtle") or player.Character:FindFirstChild("Bunny") or player.Character:FindFirstChild("Parrot") or player.Character:FindFirstChild("Piggy Bank") or player.Character:FindFirstChild("Mr.Crab") or player.Character:FindFirstChild("Puffer Fish") or player.Character:FindFirstChild("Hedgehog") or player.Character:FindFirstChild("CrocodilePal") or player.Character:FindFirstChild("King Frog") or player.Character:FindFirstChild("Kitty") or player.Character:FindFirstChild("Epic Duck") or player.Character:FindFirstChild("Octopus") or player.Character:FindFirstChild("Pet Rock") or player.Character:FindFirstChild("Sea Monster") or player.Character:FindFirstChild("Pikachu") or player.Character:FindFirstChild("OOF Spider") or player.Character:FindFirstChild("Pet Gojira") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Hungry Shark") or player.Character:FindFirstChild("Annoying Orange") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Bird") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Dragon") or player.Character:FindFirstChild("DragonTest") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Eye of Cthulhu")
- if previouspet and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= p.Name then --or player.PetsTestFolder:FindFirstChild("PetNameCheck").Value ~= ""
- -- print("Pet owned and its not the same so we will destroy it")
- -- print("Destroy")
- --local pet = player.Character:FindFirstChild(pets.Name):Destroy()
- --player.Character:FindFirstChild(pets.Name):Destroy()
- previouspet:Destroy()
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = ""
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = pets.Name
- break
- end
- if previouspet and player.PetsFolder:FindFirstChild("PetNameCheck").Value == p.Name and v.Name == p.Name then -- also need to fix or player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= p.Name
- -- print("Pet owned and its in inventory so we will destroy it")
- -- print("Destroy")
- --local pet = player.Character:FindFirstChild(pets.Name):Destroy()
- --player.Character:FindFirstChild(pets.Name):Destroy()
- previouspet:Destroy()
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = ""
- break
- end
- if not previouspet and player.PetsFolder:FindFirstChild("PetNameCheck").Value == "" and v.Name == p.Name and pets.Name == p.Name then -- something is fishy about this line of code
- -- print("Pet owned and its not in inventory so we will clone it")
- -- print("Clone")
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = pets.Name
- break
- end
- --[[ if previouspet and v.Name ~= p.Name and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= p.Name then -- something is fishy about this line of code
- previouspet:Destroy()
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = ""
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = pets.Name
- break
- end--]]
- end
- end
- else
- -- print(v.Name.." Not Owned")
- -- print(PetPrice)
- if player.leaderstats.Coins.Value >= PetPrice then
- player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - PetPrice
- v.Value = true
- for i,pets in pairs(Pets) do
- if p.Name == pets.Name then
- local previouspet = player.Character:FindFirstChild("Turtle") or player.Character:FindFirstChild("Bunny") or player.Character:FindFirstChild("Parrot") or player.Character:FindFirstChild("Piggy Bank") or player.Character:FindFirstChild("Mr.Crab") or player.Character:FindFirstChild("Puffer Fish") or player.Character:FindFirstChild("Hedgehog") or player.Character:FindFirstChild("CrocodilePal") or player.Character:FindFirstChild("King Frog") or player.Character:FindFirstChild("Kitty") or player.Character:FindFirstChild("Epic Duck") or player.Character:FindFirstChild("Octopus") or player.Character:FindFirstChild("Pet Rock") or player.Character:FindFirstChild("Sea Monster") or player.Character:FindFirstChild("Pikachu") or player.Character:FindFirstChild("OOF Spider") or player.Character:FindFirstChild("Pet Gojira") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Hungry Shark") or player.Character:FindFirstChild("Annoying Orange") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Bird") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Dragon") or player.Character:FindFirstChild("DragonTest") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Eye of Cthulhu")
- if previouspet and player.PetsFolder:FindFirstChild("PetNameCheck").Value ~= "" then
- -- print("Checking Before Cloning")
- previouspet:Destroy()
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = ""
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = pets.Name
- else
- -- print("Cloning")
- --print(pets)
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.PetsFolder:FindFirstChild("PetNameCheck").Value = pets.Name
- end
- end
- end
- else
- print("Player Doesnt Have the Coin,Hes Poor")
- end
- end
- end
- end
- end
- end)
- PetsGamepassEvent.OnServerEvent:Connect(function(player,id,Name)
- local previouspet = player.Character:FindFirstChild("Turtle") or player.Character:FindFirstChild("Bunny") or player.Character:FindFirstChild("Parrot") or player.Character:FindFirstChild("Piggy Bank") or player.Character:FindFirstChild("Mr.Crab") or player.Character:FindFirstChild("Puffer Fish") or player.Character:FindFirstChild("Hedgehog") or player.Character:FindFirstChild("CrocodilePal") or player.Character:FindFirstChild("King Frog") or player.Character:FindFirstChild("Kitty") or player.Character:FindFirstChild("Epic Duck") or player.Character:FindFirstChild("Octopus") or player.Character:FindFirstChild("Pet Rock") or player.Character:FindFirstChild("Sea Monster") or player.Character:FindFirstChild("Pikachu") or player.Character:FindFirstChild("OOF Spider") or player.Character:FindFirstChild("Pet Gojira") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Hungry Shark") or player.Character:FindFirstChild("Annoying Orange") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Bird") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Dragon") or player.Character:FindFirstChild("DragonTest") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Eye of Cthulhu")
- local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id)
- local success, errormessage = pcall(ownsGamepass);
- --print(player)
- --print(id)
- --print(Name)
- if player and not ownsGamepass then
- game:GetService("MarketplaceService"):PromptGamePassPurchase(player,id)
- print(Name)
- local function gamepassPurchaseFinished(player,id,wasPurchased)
- Market:Disconnect()
- if wasPurchased == true then
- print("Purchased")
- print(id)
- else
- print("Canceled")
- print(id)
- end
- end
- Market = MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)
- end
- if player and ownsGamepass then
- print("We own it")
- end
- end)
Add Comment
Please, Sign In to add comment