local pet = game.ReplicatedStorage.basic

script.Parent.Touched:connect(function(hit)
 if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  local ply = game.Players:GetPlayerFromCharacter(hit.Parent)
  game:GetService("MarketplaceService"):PromptProductPurchase(ply, 9069958)

 end
end)

game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo) 
 if receiptInfo.ProductId == 9069958 then
function givePet (player)
 if player then
  local character = player.Character
  if character then
   local humRootPart = character.HumanoidRootPart
   local newPet = pet:Clone ()
   newPet.Parent = character
   
   local bodyPos = Instance.new("BodyPosition", newPet)
   bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
   
   local bodyGyro = Instance.new("BodyGyro", newPet)
   bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
   
   while wait() do
    bodyPos.Position = humRootPart.Position + Vector3.new(2, 2, 3)
    bodyGyro.CFrame = humRootPart.CFrame
   end
  end)

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId,9069958) then
	 local humRootPart = character.HumanoidRootPart
   local newPet = pet:Clone ()
   newPet.Parent = character
   
   local bodyPos = Instance.new("BodyPosition", newPet)
   bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
   
   local bodyGyro = Instance.new("BodyGyro", newPet)
   bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
   
   while wait() do
    bodyPos.Position = humRootPart.Position + Vector3.new(2, 2, 3)
    bodyGyro.CFrame = humRootPart.CFrame
   end
  end)