Sungmingamerpro13

petFollowScript

Jun 14th, 2026
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.72 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2. local Players = game:GetService("Players")
  3.  
  4. RunService.Heartbeat:Connect(function()
  5.  
  6.     for _, Player in ipairs(Players:GetPlayers()) do
  7.  
  8.         local Character = Player.Character
  9.         if not Character then continue end
  10.  
  11.         local HRP = Character:FindFirstChild("HumanoidRootPart")
  12.         if not HRP then continue end
  13.  
  14.         local Pet = workspace:FindFirstChild(Player.Name .. "_Pet")
  15.         if not Pet then continue end
  16.  
  17.         local Root = Pet.Root
  18.         if not Root then
  19.             warn(Pet.Name .. " no tiene PrimaryPart")
  20.             continue
  21.         end
  22.  
  23.         local TargetPosition =
  24.             HRP.Position
  25.         - HRP.CFrame.LookVector * 4
  26.             + Vector3.new(0,2,0)
  27.  
  28.         Pet:PivotTo(CFrame.new(TargetPosition))
  29.  
  30.     end
  31.  
  32. end)
  33.  
Advertisement
Add Comment
Please, Sign In to add comment