Advertisement
InTesting

THE SUN BOSS

Mar 30th, 2020
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.50 KB | None | 0 0
  1. local function THE_SUN(owner)-- By CHL/SoftlockedUnderZero
  2.     local Settings={
  3.         NeedsPermission=true;
  4.    
  5.         };
  6. print'https://pastebin.com/raw/sKk8Vthq';print'https://pastebin.com/raw/5QSqffmx';
  7. print'Bossfight Theme="Guardian of The Former Seas"';print'Why? I like the music';
  8.  
  9. local function Instance_2(c,p)if not c then return;end;p=p or {};
  10. local a=Instance.new(c,p.Parent);for b,c in pairs(p)do local _,d=pcall(function()a[b]=c;end);
  11. if d then print(d);end;end;return a;end;
  12. local Name_ID={OptInPart=0;THESUN=0;};
  13. local function Ragdoll_v2(model)local hum=model:FindFirstChildWhichIsA'Humanoid';if not hum then
  14. return;end;hum.BreakJointsOnDeath=false;
  15. local LArm,RArm,LLeg,RLeg,torso,head,LUA,LLA,LH,RUA,RLA,RH,LUL,LLL,LF,RUL,RLL,RF,UT,LT=
  16.  model:FindFirstChild'Left Arm',model:FindFirstChild'Right Arm',model:FindFirstChild'Left Leg',
  17.  model:FindFirstChild'Right Leg',model:FindFirstChild'Torso',model:FindFirstChild'Head',model:
  18. FindFirstChild'LeftUpperArm',model:FindFirstChild'LeftLowerArm',model:FindFirstChild'LeftHand',
  19.  model:FindFirstChild'RightUpperArm',model:FindFirstChild'RightLowerArm',model:FindFirstChild
  20.  'RightHand',model:FindFirstChild'LeftUpperLeg',model:FindFirstChild'LeftLowerLeg',model:
  21.  FindFirstChild'LeftFoot',model:FindFirstChild'RightUpperLeg',model:FindFirstChild'RightLowerLeg',
  22.  model:FindFirstChild'RightFoot',model:FindFirstChild'UpperTorso',model:FindFirstChild'LowerTorso';
  23. local Set={{{LArm;{Orientation=Vector3.new(0,180,0);Position=Vector3.new(-1,1,0)};{Orientation=
  24. Vector3.new(0,180,0);Position=Vector3.new(.5,1,0)};{LimitsEnabled=true;UpperAngle=15;
  25. TwistLimitsEnabled=true;UpperAngle=-45;TwistLowerAngle=-45;};};{RArm;{Orientation=Vector3.new(0,0,0)
  26. ;Position=Vector3.new(1,1,0);};{Orientation=Vector3.new(0,0,0);Position=Vector3.new(-.5,1,0);};{
  27. LimitsEnabled=true;UpperAngle=15;TwistLimitsEnabled=true;UpperAngle=-45;TwistLowerAngle=-45;};};{
  28. RLeg;{Orientation=Vector3.new(90,0,-90);Position=Vector3.new(.5,-1,0);};{Orientation=Vector3.new(90,
  29. 0,-90);Position=Vector3.new(0,1,0);};{LimitsEnabled=true;UpperAngle=165;};};{LLeg;{Orientation=
  30. Vector3.new(90,0,-90);Position=Vector3.new(-.5,-1,0);};{Orientation=Vector3.new(90,0,-90);Position=
  31. Vector3.new(0,1,0);};{LimitsEnabled=true;UpperAngle=165;};};{head;{Orientation=Vector3.new(180,90,0)
  32. ;Position=Vector3.new(0,1,0);};{Orientation=Vector3.new(180,90,0);Position=Vector3.new(0,-.5,0);};{
  33. LimitsEnabled=true;UpperAngle=75;TwistLimitsEnabled=true;UpperAngle=-45;TwistLowerAngle=-45};};};{{
  34. LF;LLL;'LeftAnkleRigAttachment';};{LLL;LUL;'LeftKneeRigAttachment';};{LUL;LT;'LeftHipRigAttachment';
  35. };{RF;RLL;'RightAnkleRigAttachment';};{RLL;RUL;'RightKneeRigAttachment';};{RUL;LT;
  36. 'RightHipRigAttachment';};{LH;LLA;'LeftWristRigAttachment';};{LLA;LUA;'LeftElbowRigAttachment';};{
  37. LUA;UT;'LeftShoulderAttachment';'LeftCollarAttachment'};{RH;RLA;'RightWristRigAttachment';};{RLA;
  38. RUA;'RightElbowRigAttachment';};{RUA;UT;'RightShoulderAttachment';'RightCollarAttachment'};{LT;UT;
  39. 'WaistRigAttachment'};{UT;head;'NeckRigAttachment';nil;{LimitsEnabled=true;UpperAngle=-75;
  40. TwistLimitsEnabled=true;UpperAngle=-45;TwistLowerAngle=-45;};};};};hum.Died:Connect(function()
  41. for _,a in pairs(model:GetDescendants())do if a:IsA'Motor6D'then a:Destroy();end;end;
  42. if hum.RigType==Enum.HumanoidRigType.R6 then for _,a in pairs(Set[1])do local b,c;if torso then
  43. a[2].Parent,a[2].Orientation=torso,a[2].Orientation+torso.Orientation;b=Instance_2('Attachment',a[2
  44. ]);end;if a[1]then a[3].Parent,a[3].Orientation=a[1],a[3].Orientation+a[1].Orientation;
  45. c=Instance_2('Attachment',a[3]);end;a[4].Parent,a[4].Attachment0,a[4].Attachment1=torso,b,c;
  46. Instance_2('BallSocketConstraint',a[4])end;else for _,a in pairs(Set[2])do local b=a[5]or{};if a[1]then
  47. b.Attachment0=a[1][a[3]];end;if a[2]then b.Attachment1=a[2][a[4]or a[3]];end;b.Parent=UT;
  48. Instance_2('BallSocketConstraint',b);end;end;end);end;
  49. for _,a in pairs(workspace:GetChildren())do Ragdoll_v2(a);end;workspace.ChildAdded:Connect(Ragdoll_v2);
  50.     local ChangeIndex,FindFirstChildOrEtc,Storage,IndexFromTuple,TableFillNil,SunIsFighting,TableRandom,
  51.         GiveNameBasedFromName_ID,cwrap,RunService,WaitForChild,Players,SunName,IsFighting=
  52.         function(tab,ind,pri)for a,b in pairs(ind)do local _,c=pcall(function()tab[a]=b;end);
  53.         if pri and c then print(c);end;end;end,function(par,children)for _,a in pairs(children)do
  54.         local b=par:FindFirstChild(a);if b then return b;end;end;end,{},function(t,...)
  55.         for _,a in pairs{...;}do t=t[a];end;return t;end,function(t,v)for a=1,#t do if t[a]==nil then
  56.         t[a]=v;return a;end;end;table.insert(t,v);end,{},function(a)return a[math.random(1,#a)];end,
  57.         function(a)local b=Name_ID[a];if not b then return;end;Name_ID[a]=Name_ID[a]+1;
  58.         return a..Name_ID[a];end,function(a)coroutine.wrap(a)();end,game:GetService("RunService"),
  59.         function(par,name,wt)repeat local a=par:FindFirstChild(name);if a then return a;end;
  60.         wait(wt or 1/60);until nil;end,game:GetService("Players"),nil;
  61.     local TableCompareValueFromIndexes,TweenService,SuperHotSunMode=function(t,v,...)for b,a in pairs(t)do
  62.         if v==IndexFromTuple(a,...)then return b;end;end;end,game:GetService("TweenService"),false;
  63.     local Instance2,Remove=function(cn,prop)
  64.         local a=(function()local b=TableCompareValueFromIndexes(Storage,cn,'ClassName');if not b then
  65.         return;end;local c=Storage[b];if not c then return;end;Storage[b]=nil;return c;end)()or Instance.
  66.         new(cn);ChangeIndex(a,prop,1);return a;end,function(a)local c=function(d)pcall(function()
  67.         d.Parent=nil;TableFillNil(Storage,d);end);end;for _,b in pairs(a:GetDescendants())do c(b);
  68.         end;c(a);end;
  69.     Instance_2=Instance2;
  70.     local Damage,DelayRemove=function(part,dam,hitfunction)if not part then return;end;
  71.         local a=part:FindFirstAncestorWhichIsA'Model';if not a then return;end;
  72.         local b,c=a:FindFirstChildWhichIsA'Humanoid',FindFirstChildOrEtc(a,{'Head';'Torso';'UpperTorso';
  73.         'HumanoidRootPart';});if a==workspace then return;end;local d=Players:GetPlayerFromCharacter(a);
  74.         if d and Settings.NeedsPermission then if not table.find(SunIsFighting,d.Name)then return;end;
  75.         end;hitfunction=hitfunction or function()end;
  76.         if b then if not b:GetStateEnabled(Enum.HumanoidStateType.Dead)then
  77.         b:SetStateEnabled(Enum.HumanoidStateType.Dead,true);end;if b.Health>101 then b.Health=0;
  78.         hitfunction();else b:TakeDamage(dam);hitfunction();end;elseif c then Remove(c);else
  79.         pcall(function()a:BreakJoints();end);end;end,function(a,b)delay(a or 1,function()Remove(b);end);end;
  80.     local FightOptInPart=function()local Object_0=Instance_2("Part",{Color=Color3.new(0,1,0);CFrame=
  81.         CFrame.new(0,.5,-20,1,0,0,0,1,0,0,0,1);Size=Vector3.new(4,1,4);BottomSurface='Smooth';Anchored
  82.         =true;Parent=workspace;TopSurface='Smooth';});local Object_1=Instance_2("BillboardGui",{
  83.         AlwaysOnTop=true;ExtentsOffsetWorldSpace=Vector3.new(0,10,0);MaxDistance=30;Parent=Object_0;Size=
  84.         UDim2.new(10,0,2,0);});Instance_2("TextLabel",{TextWrapped=true;Parent=Object_1;
  85.         TextStrokeTransparency=0;Size=UDim2.new(1,0,1,0);BorderColor3=Color3.new(.105882,.164706,.207843)
  86.         ;Text=[==[Step Here to run away from/Fight the Sun]==];TextColor3=Color3.new(1,1,1);Font='Code';
  87.         BackgroundTransparency=1;TextScaled=true;});local deb=true;local d=function()
  88. Object_0.BrickColor=BrickColor.new("Lime green");deb=true;end;Object_0.Touched:Connect(function(a)
  89. if not deb or not a then return;end;Object_0.BrickColor=BrickColor.new"Really red";deb=false;
  90. local b=a:FindFirstAncestorWhichIsA'Model';local c=game:GetService'Players';if not(b and c)then d();return;
  91. end;local e=c:GetPlayerFromCharacter(b);if not e then d();return;end;local f=table.find(SunIsFighting,e.Name
  92. )if f then SunIsFighting[f]=nil;else TableFillNil(SunIsFighting,e.Name);end;wait(2);d();deb=true;end);
  93. Object_0.Name=GiveNameBasedFromName_ID'OptInPart';end;
  94.     if Settings.NeedsPermission then
  95.         FightOptInPart();
  96.     else
  97.         local a=function(b)TableFillNil(SunIsFighting,b.Name);end;
  98.         local c=game:GetService("Players");
  99.         for _,b in pairs(c:GetPlayers())do a(b);end;
  100.         c.PlayerAdded:Connect(a);
  101.     end;
  102.     local CreateTheSUN=function()
  103.         local Health=100;
  104. SunName=GiveNameBasedFromName_ID'THESUN';
  105.        
  106. local Object_0=Instance_2("Part",{Color=Color3.new(1,1,0);CFrame=CFrame.new(0,0,-50,1,0,0,0,1,0,0,0,1);
  107.     Material='Neon';Size=Vector3.new(10,10,10);BottomSurface='Smooth';CanCollide=false;Anchored=true;
  108.     Name=SunName;Parent=workspace;Shape='Ball';TopSurface='Smooth';});local a=Instance_2("Part",{Color=
  109.     Color3.new(1,1,0);CFrame=Object_0.CFrame;Name='a';Material='ForceField';Size=Vector3.new(11,11,11);
  110.     BottomSurface='Smooth';CanCollide=false;Anchored=true;Transparency=.5;Parent=Object_0;Shape='Ball';
  111.     TopSurface='Smooth';});local b=Instance_2("Part",{Color=Color3.new(1,1,0);CFrame=Object_0.CFrame;Name=
  112.     'b';Material='Slate';Size=Vector3.new(10.5,10.5,10.5);BottomSurface='Smooth';CanCollide=false;
  113.     Anchored=true;Transparency=.15000000596046;Parent=Object_0;Shape='Ball';TopSurface='Smooth';});
  114.     local Song=Instance2('Sound',{Name='BossFightTheme';Volume=0;SoundId='rbxassetid://3355655842';
  115.     Looped=true;Parent=Object_0;});Song:Play();
  116.     local HealthBG=Instance2('BillboardGui',{AlwaysOnTop=true;StudsOffsetWorldSpace=Vector3.new(0,
  117.     10,0);Name='Health';Size=UDim2.new(10,0,2,0);ClipsDescendants=false;Parent=Object_0;});
  118.     Instance2('TextBox',{BackgroundTransparency=1;Size=UDim2.new(1,0,1,0);Font='Code';Text='Heat='..
  119.         Health;Name='a';TextColor3=Color3.fromRGB(255,255,255);TextScaled=true;Parent=HealthBG;
  120.         TextStrokeTransparency=0;});
  121.     local THE_SUN=Object_0;
  122.     local h=true;
  123.     THE_SUN.Touched:Connect(function(i)if not h then return;end;h=false;Damage(i,10);h=true;end);
  124.     local IsInMove=true;local CurrentMove=1;
  125.     local IsDefeated=false;
  126.     local FightingMoves={
  127.         function()if not IsInMove then return;end;IsInMove=false;local LaserSound=THE_SUN:FindFirstChild
  128.             'SoundFX1'or Instance2('Sound',{Parent=THE_SUN;Name='SoundFX1';});ChangeIndex(LaserSound,{
  129.             Looped=true;Volume=1;SoundId='rbxassetid://1447681819';EmitterSize=10000;});LaserSound:Play();
  130.             for c=1,120 do if IsFighting then
  131.                 if IsFighting.Character then
  132.                 if IsFighting.Character:FindFirstChild'HumanoidRootPart'then
  133.             local POS=IsFighting.Character.HumanoidRootPart.Position;local d=workspace:FindFirstChild
  134.             'SunBossBeam∞'or(function()local e=Instance2('Part',{Name='SunBossBeam∞';BrickColor=BrickColor
  135.             .new("New Yeller");Parent=workspace;Material='Neon';Anchored=true;CanCollide=false;Position=
  136.             Vector3.new(0,10,0);Size=Vector3.new(.1,.1,.1);Transparency=0;Shape='Block';});local g=true;
  137.             e.Touched:Connect(function(f)if not g then return;end;g=false;Damage(f,2);wait(.25);g=true;
  138.             end);return e;end)();wait();local e=(THE_SUN.Position-POS).Magnitude;d.CFrame=CFrame.new(
  139.             THE_SUN.Position,POS);d.CFrame=d.CFrame*CFrame.new(0,0,-((e/2)+5));d.Size=Vector3.new(.25,.25,
  140.             e+5);wait();end;elseif not IsFighting then if workspace:FindFirstChild'SunBossBeam∞'then
  141.             Remove(workspace:FindFirstChild'SunBossBeam∞');end;break;end;
  142.                 end;
  143.                 end;LaserSound:Stop();IsInMove=
  144.             true;end;
  145.         function()if not IsInMove then return;end;IsInMove=false;SuperHotSunMode=true;TweenService:Create(
  146.             THE_SUN,TweenInfo.new(3,Enum.EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0),{Color=
  147.             Color3.fromRGB(0,0,255);}):Play();wait(10);TweenService:Create(THE_SUN,TweenInfo.new(3,Enum.
  148.             EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0),{Color=Color3.fromRGB(255,255,0);}):
  149.             Play();SuperHotSunMode=false;wait(3);IsInMove=true;end;
  150.        
  151.        
  152.        
  153.         };
  154.    
  155.     cwrap(function()
  156.         while true do
  157.             (function()
  158.                 if #SunIsFighting==0 then return;end;
  159.                 local targetplayer;
  160.                 local targetcharacter;
  161.                 repeat
  162.                     if #SunIsFighting>0 and not IsDefeated then
  163.                         pcall(function()
  164.                             targetplayer=Players:FindFirstChild(TableRandom(SunIsFighting));
  165.                         end);  
  166.                         if targetplayer then
  167.                             targetcharacter=targetplayer.Character;
  168.                             if targetcharacter then
  169.                                 if targetcharacter.Parent~=nil and targetcharacter:FindFirstChild'HumanoidRootPart'then
  170.                                     IsFighting=targetplayer;
  171.                                     break;
  172.                                 end;
  173.                             end;
  174.                         end;
  175.                     end;
  176.                     wait(.1);
  177.                     IsFighting=nil;
  178.                 until IsDefeated;
  179.                 if IsFighting then
  180.                     TableRandom(FightingMoves)();
  181.                     if workspace:FindFirstChild('SunBossBeam∞')then
  182.                         Remove(workspace:FindFirstChild('SunBossBeam∞'))
  183.                     end
  184.                     if IsFighting and HealthBG:FindFirstChild'a'and HealthBG.Parent~=nil then
  185.                         HealthBG.a.Text='~ Cooling ~';
  186.                         Health=Health - 1;
  187.                         wait(1);
  188.                         HealthBG.a.Text='Heat = '.. Health;
  189.                         if Health<=0 then
  190.                             wait(.5);
  191.                             HealthBG.a.Text='The Sun cooled too much.';
  192.                             IsFighting = nil;
  193.                             IsDefeated = true;
  194.                             TweenService:Create(THE_SUN,TweenInfo.new(3,Enum.EasingStyle.Quint,Enum.
  195.                                 EasingDirection.Out,0,false,0),{Color=Color3.fromRGB(255,255,255);})
  196.                                 :Play();
  197.                             wait(4);
  198.                             for _=1,200 do
  199.                                 THE_SUN.Position = THE_SUN.Position - Vector3.new(0,.1,0);
  200.                                 wait(.1);
  201.                             end;
  202.                         end;
  203.                     end;
  204.                 end;
  205.             end)()
  206.             wait(1);
  207.         end;
  208.     end);
  209.     end;
  210.     CreateTheSUN()
  211.     workspace.ChildRemoved:Connect(function(a)
  212.         for b in pairs(Name_ID)do
  213.             if b==a.Name:sub(1,b:len())then
  214.                 if b=='OptInPart'and not workspace:FindFirstChild('OptInPart'..Name_ID.OptInPart)then
  215.                     wait(2);FightOptInPart();
  216.                 elseif b=='THESUN'and not workspace:FindFirstChild('THESUN'..Name_ID.THESUN)then
  217.                     wait(2);CreateTheSUN();
  218.                 end;
  219.                 break;
  220.             end;
  221.         end;
  222.     end);
  223.     cwrap(function()
  224.         while true do
  225.             local a=WaitForChild(workspace,'THESUN'..Name_ID.THESUN,.1);
  226.             local b=Instance2('Part',{Color=a.Color;Material='Neon';
  227.                 Transparency=0;Parent=workspace;Position=a.Position;CanCollide=false;Anchored=true;
  228.                 Shape='Ball';Size=Vector3.new(10,10,10)});DelayRemove(1.5,b);
  229.             game:GetService("TweenService"):Create(b,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.
  230.                 EasingDirection.Out,0,false,0),{Transparency=1;Size=(SuperHotSunMode and Vector3.new(
  231.                 100,100,100))or Vector3.new(20,20,20);}):Play();
  232.             local e;
  233.             if SuperHotSunMode then
  234.                 e=b.Touched:Connect(function(c)
  235.                     if not SuperHotSunMode then
  236.                         return;end;
  237.                     Damage(c,10,function()
  238.                         if not e then return;end;
  239.                         e:Disconnect();
  240.                     end);
  241.                     wait(.25);
  242.                 end);
  243.             end;
  244.             wait(2);
  245.            
  246.         end;
  247.     end);
  248.     cwrap(function()
  249.         while true do
  250.             if IsFighting then
  251.                 if not table.find(SunIsFighting,IsFighting.Name)then
  252.                     IsFighting=nil;
  253.                 end;
  254.             end;
  255.             local a=WaitForChild(workspace,'THESUN'.. Name_ID.THESUN ,1);
  256.             local b=a:FindFirstChild'BossFightTheme';
  257.             if b then
  258.                 if b.Volume<5 and IsFighting then
  259.                     b.Volume=b.Volume + .05;
  260.                 elseif b.Volume>0 and not IsFighting then
  261.                     b.Volume=b.Volume - .05;
  262.                 end;
  263.             end;
  264.             if IsFighting then
  265.                 if IsFighting.Character:FindFirstChild'HumanoidRootPart'then
  266.                     local HRPPOS=IsFighting.Character.HumanoidRootPart.Position;
  267.                     if a.Position.Y>HRPPOS.Y+7 then
  268.                         a.Position=a.Position - Vector3.new(0,.1,0);
  269.                     elseif a.Position.Y<HRPPOS.Y+6 then
  270.                         a.Position=a.Position + Vector3.new(0,.1,0);
  271.                     end;
  272.                     local d=a.Position
  273.                     a.CFrame=CFrame.new(d,Vector3.new(HRPPOS.x,d.y,HRPPOS.z));
  274.                     a.CFrame=a.CFrame*CFrame.new(0,0,-1);
  275.                 end;
  276.             end;
  277.             for _,c in pairs{a:FindFirstChild'a';a:FindFirstChild'b';}do
  278.                 if c then
  279.                     c.Color=a.Color
  280.                     c.Position=a.Position
  281.                 end;
  282.             end;
  283.             wait(.1);
  284.         end;
  285.     end);
  286.     Players.PlayerRemoving:Connect(function(b)
  287.         local a=table.find(SunIsFighting,b.Name);
  288.         if a then SunIsFighting[a]=nil;end;
  289.     end);
  290. end;
  291. THE_SUN(loadstring'return owner;'()or game.Players:WaitForChild('SoftlockedUnderZero'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement