Advertisement
StefanBashkir

ROBLOX Part Orbit

Sep 12th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local centerPart = workspace.CenterPart
  2. local orbitPart = workspace.OrbitPart
  3. local offset = 10
  4. local orbitCompletionTime = 5 -- in seconds, roughly since wait() times can change
  5.  
  6. while wait() do
  7.     local startTime = tick()
  8.     local frameTime = wait()
  9.     for theta = 0, math.pi * 2, (math.pi * 2) / (orbitCompletionTime/frameTime) do
  10.         orbitPart.CFrame = centerPart.CFrame * (CFrame.Angles(0,theta,0) * CFrame.new(0,0,offset))
  11.         wait()
  12.     end
  13.     print(("Orbit completed in %s seconds."):format(tick() - startTime))
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement