Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. -- NEVS STEPS TO ORBITAL SUCCESS:
  2. -- 1. COPY/PASTE INTO THE SUN (OR PLANET BRICK IF YOU'RE MAKING A MOON ORBIT)
  3. -- 2. CLICK ON THE FIRST PLANET MODEL THAT WILL BE ORBITING THE SUN (OR THE MOONS MODEL)
  4. -- 3. SET THE PRIMARYPART PROPERTY OF THAT MODEL TO THE PLANET BRICK INSIDE THE MODEL
  5. -- 4. CHANGE THE VALUE OF "local orbiter" IN THIS SCRIPT TO game.Workspace["THE EXACT NAME OF THE PLANETS MODEL INCLUDING SPACES"]
  6. -- 5. ADJUST "local repeatTime, local distance, local update" TO MEET YOUR PARAMETERS. REMEMBER THAT THE LOWER THE VALUE OF "repeatTime" IS, THE MORE LAG THERE WILL BE.
  7.  
  8.  
  9.  
  10. local ang = 0 --Declaring the starting angle, no need to change this.
  11.  
  12. local origin = script.Parent --This is what the orbiter orbits around
  13. local orbiter = game.Workspace["Terran 2"] --Make sure this is set to a Model and make sure the Model has a Primary Part set.
  14. --The primary part will be the origin point
  15.  
  16. local repeatTime = .1 --The amount of time it will take before each run
  17. local distance = 2000 --How far the orbiter is away from the origin
  18. local update = .0001 --How far the orbiter moves per run
  19.  
  20.  
  21. while wait(repeatTime) do
  22. print("A")
  23. local newA = origin.CFrame * CFrame.fromEulerAnglesXYZ(0,ang,0) * CFrame.new(0,0,(origin.Size.Z/2 + origin.Size.X/2) + distance)
  24. orbiter:SetPrimaryPartCFrame(CFrame.new(newA.x,newA.y,newA.z))
  25. ang = ang + update
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement