Guest User

Pet Script

a guest
Jun 15th, 2017
34,553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. local char = script.Parent.Parent
  2. local hum = char:FindFirstChild("Humanoid")
  3. local torso = char:FindFirstChild("Torso")
  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 torso ~= nil then
  25. if hum.Health >= 0 then
  26. local cf = torso.CFrame * CFrame.new(3,2+fl,3)
  27. pet.BodyPosition.Position = Vector3.new(cf.x,cf.y,cf.z)
  28. pet.BodyGyro.CFrame = torso.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