plr = game:WaitForChild("LocalPlayer")
pet = script.Parent
MPS = game:GetService("MarketplaceService")
VipId = 9069958

MPS:PromptPurchase(plr, VipId) 


game.Players.PlayerAdded:connect(function(plr)
 if MPS:PlayerOwnsAsset(plr, VipId) then
function givePet (player)
   if player 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)
         

         newPet.CanCollide = false
         
         while wait() do
            bodyPos.Position = humRootPart.Position + Vector3.new(2, 2, 3)
            bodyGyro.CFrame = humRootPart.CFrame
         end
         
      end
   end
end

game.Players.PlayerAdded:Connect(function(player)
   player.CharacterAdded:Connect(function(char)
      givePet(player)
   end)
end)

pls edit it and tell me

1 comment

0

Well, i can see a few mistakes, the LocalPlayer is not a valif member of the workspace, you get the local player by doing the following; game.Players.LocalPlayer and the two functions that you created, wont work they will both cancel eachother.