Advertisement
CluelessDev

Pet bobbing script

Feb 21st, 2023
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. -- assuming theres a the script is under a model
  2.  
  3. local function GetBobbingCF(pet: Model, amplitude, frequency)
  4.     local sine = amplitude * math.sin(time() * frequency) + amplitude
  5.     local bobbingCF = pet:GetPivot():Lerp(CFrame.new(0, sine, 0), 0.1)
  6.    
  7.     return bobbingCF
  8. end
  9.  
  10. local Pwet = script.Parent
  11. local amp = script.Parent.Amplitude
  12. local freq = script.Parent.Frequency
  13.  
  14. while true do
  15.     Pwet:PivotTo(GetBobbingCF(Pwet, amp.Value, freq.Value))
  16.     task.wait()
  17. end
  18.  
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement