Advertisement
princeofheaven

Untitled

Sep 30th, 2015
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. --ONLY EDIT WHERE INDICATED BY --<'s AND ONLY WHERE INDICATED BY -->'s IF YOU HAVE EXPERIENCE IN LUA SYNTAX
  2. --Server-Sided for maximum efficiency
  3. --@tusKOr661
  4. --/clearcolors newColor
  5. --/addcolor newColor
  6. --/endorb
  7. wait();
  8. if(script)then pcall(game.Destroy,script); end;
  9. --loadstring('\0')();
  10. module={
  11. settings={
  12. colors={'Really red';'Black'};--> Change to make number of colors in secondary trailMode and orb color changing
  13. owner='tusKOr661';--< Change to your name
  14. trailMode='default';--<secondary, default
  15. speed=100;--<default speed -> int between 0 and inf
  16. };
  17. data={
  18. orbInstance=nil;
  19. lastLocation=CFrame.new(0,10,0);
  20. lastOwnerLocation=CFrame.new(0,10,0);
  21. lastColorInt=1;
  22. };
  23. functions={
  24. lockInstance=function(instance)
  25. local connection;
  26. connection=instance.ancestryChanged:connect(function()
  27. pcall(connection.disconnect,connection);
  28. instance:destroy();
  29. module.functions.newOrb();
  30. end);
  31. end;
  32. newOrb=function()
  33. pcall(function() module.data.orbInstance:destroy(); end);
  34. local orb=Instance.new('Part',workspace);
  35. orb.Anchored=true;
  36. orb.Name='ORB\0ORB';
  37. orb.TopSurface,orb.BottomSurface='Smooth','Smooth';
  38. orb.Size,orb.Shape=Vector3.new(1,1,1),'Ball';
  39. orb.Color=BrickColor.new(module.settings.colors[(module.data.lastColorInt%#module.settings.colors)+1]).Color;
  40. module.functions.lockInstance(orb);
  41. module.data.orbInstance=orb;
  42. end;
  43. mainLoop=function(time)
  44. module.data.lastColorInt=module.data.lastColorInt+1;
  45. if(module.data.orbInstance and module.data.orbInstance.Parent)then
  46. local cframe=module.data.orbInstance.CFrame;
  47. local distance=(cframe.p-module.data.lastLocation.p).magnitude;
  48. module.data.orbInstance.Color=BrickColor.new(module.settings.colors[(module.data.lastColorInt%#module.settings.colors)+1]).Color;
  49. if(distance>0)then
  50. local trail=Instance.new('Part',module.data.orbInstance);
  51. trail.Color=module.data.orbInstance.Color;
  52. trail.Anchored=true;
  53. trail.CanCollide=false;
  54. trail.TopSurface='Smooth';
  55. trail.BottomSurface='Smooth';
  56. trail.FormFactor='Custom';
  57. trail.Size=((module.settings.trailMode=='default'and Vector3.new(0,0,distance))or Vector3.new(1,1,1));
  58. trail.CFrame=((module.settings.trailMode~='default' and CFrame.new(module.data.lastLocation.p,cframe.p)*CFrame.new(0,0,.5)*CFrame.Angles​(math.rad(math.random(1,360)),math.rad(math.random(1,360)),math.rad(math.random(​1,360))))or(CFrame.new(module.data.lastLocation.p,cframe.p)*CFrame.new(0,0,-distance/2)))
  59. coroutine.wrap(function()
  60. local f=trail.CFrame;
  61. local s=trail.Size;
  62. game:service'Debris':AddItem(trail,1.5);
  63. wait();
  64. for i=0,1,.1 do
  65. trail.Size=s:lerp(((module.settings.trailMode=='default' and Vector3.new(1,1,distance))or Vector3.new(1,1,1)),i);
  66. trail.CFrame=f;
  67. trail.Transparency=i;
  68. wait(3/30);
  69. end;
  70. trail:destroy();
  71. end)();
  72. end;
  73. local player=game:service'Players':findFirstChild(module.settings.owner);
  74. if(player~=nil)then
  75. pcall(function() module.data.lastOwnerLocation=player.Character.Torso.CFrame; end);
  76. pcall(function() module.playerChatConnection:disconnect(); end);
  77. module.playerChatConnection=player.Chatted:connect(function(message,...)
  78. local command,rest=message:match'/(%a+)%s?(.*)';
  79. if(command and command:lower()=='endorb')then
  80. coroutine.wrap(function()
  81. local exp; exp=function(x)
  82. local t=type(x);
  83. if(t=='table')then
  84. for _,v in next,x do
  85. ypcall(exp,v);
  86. x[_]=nil;
  87. end;
  88. elseif(t=='function')then
  89. setfenv(x,{});
  90. elseif(t=='userdata')then
  91. pcall(game.Destroy,x);
  92. end;
  93. end;
  94. exp(module);
  95. module={};
  96. end)();
  97. elseif(command and command:lower()=='clearcolors')then
  98. module.settings.colors={tostring(BrickColor.new(rest))};
  99. elseif(command and command:lower()=='addcolor')then
  100. table.insert(module.settings.colors,rest);
  101. elseif(command and command:lower()=='settrail')then
  102. module.settings.trailMode=((rest:match'^de' and 'default')or'secondary');
  103. elseif(command and command:lower()=='setspeed')then
  104. module.settings.speed=((tonumber(rest)or 1));
  105. end;
  106. end);
  107. end;
  108. local wantedLocation=CFrame.new(module.data.lastOwnerLocation.p)*CFrame.Angles(math.ra​d(time*.5)*module.settings.speed,math.rad(time*module.settings.speed),math.rad(-(time*.75))*module.settings.speed)*CFrame.new(0,math.cos(time)*1.5,-5);
  109. module.data.orbInstance.CFrame=module.data.orbInstance.CFrame:lerp(wantedLo​cation,.3);
  110. module.data.lastLocation=cframe;
  111. end;
  112. end;
  113. };
  114. };
  115. module.functions.newOrb();
  116. game:service'RunService'.Stepped:connect(function(...)
  117. local a,b=ypcall(module.functions.mainLoop,...);
  118. if(not a)then error(b,2); end;
  119. end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement