Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Client Side
- local Pets = game.ReplicatedStorage.Pets:GetDescendants()
- local TouchPads = game.Workspace:WaitForChild("ShopPlaceModels"):GetDescendants()
- local PetEvent = game.ReplicatedStorage.Remotes.PetEvent
- local GamepassPetEvent = game.ReplicatedStorage.Remotes.GamepassPetEvent
- local PremiumPetEvent = game.ReplicatedStorage.Remotes.PremiumPetEvent
- local player = game.Players.LocalPlayer
- local debounce = true
- for i,gamepass in pairs(TouchPads) do
- if gamepass:IsA("Part") and gamepass.Name == "GamepassTouchPad" then
- gamepass.Touched:Connect(function()
- if player and debounce then
- debounce = false
- local GamepassPetName = gamepass:WaitForChild("Value").Value
- local Gamepassid = gamepass:WaitForChild("id").Value
- print(GamepassPetName)
- print(Gamepassid)
- GamepassPetEvent:FireServer(GamepassPetName,Gamepassid)
- for i,petprices in pairs(Pets) do
- if petprices:IsA("Part") and petprices.Name == "PricePart" then
- -- Update the price text idk
- end
- end
- wait(1)
- debounce = true
- return
- end
- end)
- end
- end
- -- Server side
- local PetEvent = game.ReplicatedStorage.Remotes.PetEvent
- local GamepassPetEvent = game.ReplicatedStorage.Remotes.GamepassPetEvent
- local PremiumPetEvent = game.ReplicatedStorage.Remotes.PremiumPetEvent
- local ActualPets = game.ReplicatedStorage.Pets:GetChildren()
- local MarketplaceService = game:GetService("MarketplaceService")
- local Market
- GamepassPetEvent.OnServerEvent:Connect(function(player,GamepassPetName,Gamepassid)
- local Pets = player.Character:FindFirstChild("Frost Dragon") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Eye of Cthulhu") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Eye of Cthulhu")
- local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,Gamepassid)
- local success, errormessage = pcall(ownsGamepass);
- --print(GamepassPetName)
- --print(Gamepassid)
- if player and not ownsGamepass then
- game:GetService("MarketplaceService"):PromptGamePassPurchase(player,Gamepassid)
- local function gamepassPurchaseFinished(player,Gamepassid,wasPurchased)
- Market:Disconnect()
- if wasPurchased == true then
- print("Purchased")
- for i,pets in pairs(ActualPets) do
- print("hi")
- print(Gamepassid)
- print(GamepassPetName)
- if pets:IsA("Model") and pets.Name == GamepassPetName then
- local Pets = player.Character:FindFirstChild("Frost Dragon") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Eye of Cthulhu") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Eye of Cthulhu")
- if Pets and player.Pets:FindFirstChild("PetsName").Value ~= "" then
- Pets:Destroy()
- player.Pets:FindFirstChild("PetsName").Value = ""
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.Pets:FindFirstChild("PetsName").Value = pets.Name
- --GamepassPetEvent:FireClient(player,GamepassPetName,Gamepassid)
- break
- else
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.Pets:FindFirstChild("PetsName").Value = pets.Name
- --GamepassPetEvent:FireClient(player,GamepassPetName,Gamepassid)
- break
- end
- end
- end
- else
- print("Canceled")
- return
- end
- end
- Market = MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)
- end
- if player and ownsGamepass then
- for i,pets in pairs(ActualPets) do
- --print(pets.Name)
- -- print(Name)
- if pets:IsA("Model") and pets.Name == GamepassPetName then
- -- print("We own it") -- If we Own the gamepass
- local Pets = player.Character:FindFirstChild("Frost Dragon") or player.Character:FindFirstChild("Hell Dragon") or player.Character:FindFirstChild("Shadow Dragon") or player.Character:FindFirstChild("Megavore") or player.Character:FindFirstChild("Eye of Cthulhu") or player.Character:FindFirstChild("Magma Dragon") or player.Character:FindFirstChild("Arctic Reindeer") or player.Character:FindFirstChild("Evil Unicorn") or player.Character:FindFirstChild("Gray Wolf") or player.Character:FindFirstChild("Dog") or player.Character:FindFirstChild("T-Rex") or player.Character:FindFirstChild("Otter") or player.Character:FindFirstChild("Scorpion") or player.Character:FindFirstChild("Alien Bee") or player.Character:FindFirstChild("Phoenix") or player.Character:FindFirstChild("Eye of Cthulhu")
- if Pets and player.Pets:FindFirstChild("PetsName").Value ~= GamepassPetName then
- -- print("idk")
- Pets:Destroy()
- player.Pets:FindFirstChild("PetsName").Value = ""
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.Pets:FindFirstChild("PetsName").Value = pets.Name
- GamepassPetEvent:FireClient(player,GamepassPetName,Gamepassid)
- break
- end
- if Pets and player.Pets:FindFirstChild("PetsName").Value == GamepassPetName and Pets.Name == GamepassPetName then
- -- print("idk")
- Pets:Destroy()
- player.Pets:FindFirstChild("PetsName").Value = ""
- GamepassPetEvent:FireClient(player,GamepassPetName,Gamepassid)
- break
- end
- if not Pets and player.Pets:FindFirstChild("PetsName").Value == "" and pets.Name == GamepassPetName then
- -- print("idk")
- local pet = pets:Clone()
- pet.Parent = player.Character
- player.Pets:FindFirstChild("PetsName").Value = pets.Name
- GamepassPetEvent:FireClient(player,GamepassPetName,Gamepassid)
- break
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement