Advertisement
pvzexpert

Untitled

May 12th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local char = script.Parent.Parent
  2. local hum = char:FindFirstChild("Humanoid")
  3. local Head = char:FindFirstChild("Head")
  4. local pet = script.Parent
  5.  
  6. local maxFloat = 1
  7. local floatInc = 0.025
  8. local sw = false
  9. local fl = 0
  10.  
  11. while true do
  12.     wait()
  13.     if not sw then
  14.         fl = fl + floatInc
  15.         if fl >= maxFloat then
  16.             sw = true
  17.         end
  18.     else
  19.         fl = fl - floatInc
  20.         if fl <=-maxFloat then
  21.             sw = false
  22.         end
  23.     end
  24.     if pet ~= nil and hum ~= nil and Head ~= nil then
  25.         if hum.Health >= 0 then
  26.             local cf = Head.CFrame * CFrame.new(3,2+fl,3)
  27.             pet.BodyPosition.Position = Vector3.new(cf.x,cf.y,cf.z)
  28.             pet.BodyGyro.CFrame = Head.CFrame * CFrame.new(3,0,-3)
  29.         else
  30.             break
  31.         end
  32.     end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement