KrYn0MoRe

sao death effect v2

Nov 27th, 2020 (edited)
955
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local partfolder = Instance.new("Folder")
  2. partfolder.Parent = script
  3.  
  4. function bind(char)
  5.     if char then else return end
  6.     local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
  7.     local hum = char:FindFirstChildOfClass("Humanoid")
  8.    
  9.     local function break_part(part)
  10.         part.Locked = true
  11.         game:GetService("TweenService"):Create(part,TweenInfo.new(1),{Transparency = 1, Color = Color3.fromRGB(0, 170, 255)}):Play()
  12.         game:GetService("Debris"):AddItem(part,1)
  13.         for i = 1,14 do
  14.             local shard = Instance.new("WedgePart")
  15.             shard.Anchored = false
  16.             shard.CanCollide = false
  17.             shard.Locked = true
  18.             shard.Color = Color3.fromRGB(0, 170, 255)
  19.             shard.Size = Vector3.new(0.05, 0.7, 0.7)
  20.             shard.BrickColor = BrickColor.new("Cyan")
  21.             shard.Material = Enum.Material.Neon
  22.             shard.Parent = partfolder
  23.             game:GetService("TweenService"):Create(shard,TweenInfo.new(math.random(3,5)),{Transparency = 1}):Play()
  24.             game:GetService("Debris"):AddItem(shard,5)
  25.             if i == 1 then
  26.                 shard.CFrame = part.CFrame * CFrame.new(math.random(4,6)/14,0,0)
  27.             elseif i == 2 then
  28.                 shard.CFrame = part.CFrame * CFrame.new(-math.random(4,6)/14,0,0)
  29.             elseif i == 3 then
  30.                 shard.CFrame = part.CFrame * CFrame.new(0,math.random(4,6)/14,0)
  31.             elseif i == 4 then
  32.                 shard.CFrame = part.CFrame * CFrame.new(0,-math.random(4,6)/14,0)
  33.             elseif i == 5 then
  34.                 shard.CFrame = part.CFrame * CFrame.new(0,0,math.random(4,6)/14)
  35.             elseif i == 6 then
  36.                 shard.CFrame = part.CFrame * CFrame.new(0,0,-math.random(4,6)/14)
  37.             elseif i == 7 then
  38.                 shard.CFrame = part.CFrame * CFrame.new(math.random(4,6)/14,-math.random(4,6)/14,math.random(4,6)/14)
  39.             elseif i == 8 then
  40.                 shard.CFrame = part.CFrame * CFrame.new(-math.random(4,6)/14,-math.random(4,6)/14,math.random(4,6)/14)
  41.             elseif i == 9 then
  42.                 shard.CFrame = part.CFrame * CFrame.new(math.random(4,6)/14,-math.random(4,6)/14,-math.random(4,6)/14)
  43.             elseif i == 10 then
  44.                 shard.CFrame = part.CFrame * CFrame.new(-math.random(4,6)/14,-math.random(4,6)/14,-math.random(4,6)/14)
  45.             elseif i == 11 then
  46.                 shard.CFrame = part.CFrame * CFrame.new(math.random(4,6)/14,math.random(4,6)/14,math.random(4,6)/14)
  47.             elseif i == 12 then
  48.                 shard.CFrame = part.CFrame * CFrame.new(-math.random(4,6)/14,math.random(4,6)/14,math.random(4,6)/14)
  49.             elseif i == 13 then
  50.                 shard.CFrame = part.CFrame * CFrame.new(math.random(4,6)/14,math.random(4,6)/14,-math.random(4,6)/14)
  51.             elseif i == 14 then
  52.                 shard.CFrame = part.CFrame * CFrame.new(-math.random(4,6)/14,math.random(4,6)/14,-math.random(4,6)/14)
  53.             end
  54.             local body = Instance.new("BodyVelocity",shard)
  55.             body.Velocity = (shard.Position-part.Position).Unit * Vector3.new(.5,.5,.5) * math.random(7,10)
  56.             body.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  57.             local angle = Instance.new("BodyAngularVelocity",shard)
  58.             angle.AngularVelocity = Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5))
  59.             angle.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  60.         end
  61.     end
  62.  
  63.     local function ps1(p)
  64.         local particle = Instance.new("ParticleEmitter")
  65.         particle.Parent = p
  66.         particle.Rotation = NumberRange.new(0, 360)
  67.         particle.Color = ColorSequence.new(Color3.new(0.227451, 0.431373, 1),Color3.new(0, 0.666667, 1))
  68.         particle.Enabled = false
  69.         particle.LightEmission = 2
  70.         particle.Texture = "rbxassetid://268667620"
  71.         particle.Transparency = NumberSequence.new(0,1)
  72.         particle.ZOffset = 2
  73.         particle.Size = NumberSequence.new(0.5, 0)
  74.         particle.Lifetime = NumberRange.new(4, 6)
  75.         particle.Rate = 1000
  76.         particle.RotSpeed = NumberRange.new(0, 360)
  77.         particle.SpreadAngle = Vector2.new(180, 180)
  78.         particle.VelocitySpread = 200
  79.         particle.Speed = NumberRange.new(0, 5)
  80.         particle.Enabled = false
  81.         particle:Emit(50)
  82.     end
  83.    
  84.     local function ps2(p)
  85.         local particle = Instance.new("ParticleEmitter")
  86.         particle.Parent = p
  87.         particle.Rotation = NumberRange.new(0, 360)
  88.         particle.Color = ColorSequence.new(Color3.new(0.227451, 0.431373, 1),Color3.new(0, 0.666667, 1))
  89.         particle.Enabled = false
  90.         particle.LightEmission = 2
  91.         particle.Texture = "rbxassetid://268667620"
  92.         particle.Transparency = NumberSequence.new(0,1)
  93.         particle.ZOffset = 2
  94.         particle.Size = NumberSequence.new(0.5, 0)
  95.         particle.Lifetime = NumberRange.new(4, 6)
  96.         particle.Rate = 1000
  97.         particle.RotSpeed = NumberRange.new(0, 360)
  98.         particle.SpreadAngle = Vector2.new(0, 180)
  99.         particle.VelocitySpread = 200
  100.         particle.EmissionDirection = "Front"
  101.         particle.Speed = NumberRange.new(0, 5)
  102.         particle.Enabled = false
  103.         particle:Emit(50)
  104.     end
  105.    
  106.     local function shatter()
  107.         for _,obj in pairs(char:GetDescendants()) do
  108.             if obj:IsA("Part") or obj:IsA("UnionOperation") or obj:IsA("BasePart") or obj:IsA("MeshPart") then
  109.                 local body = Instance.new("BodyVelocity",obj)
  110.                 body.Velocity = Vector3.new(math.random(-10,10)/10,math.random(-10,10)/10,math.random(-10,10)/10) * math.random(2,3)
  111.                 body.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  112.                 local angle = Instance.new("BodyAngularVelocity",obj)
  113.                 angle.AngularVelocity = Vector3.new(math.random(-3,3),math.random(-3,3),math.random(-3,3))
  114.                 angle.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  115.                 obj.Anchored = false
  116.                 obj.CanCollide = false
  117.                 if obj.Parent == char then
  118.                     game:GetService("TweenService"):Create(obj,TweenInfo.new(4),{Transparency = 1}):Play()
  119.                     --break_part(obj)
  120.                     ps1(obj)
  121.                 end
  122.                 game:GetService("Debris"):AddItem(obj,5)
  123.             end
  124.             if obj:IsA("Texture") or obj:IsA("Decal") or obj:IsA("ParticleEmitter") then
  125.                 obj:Destroy()
  126.             end
  127.         end
  128.     end
  129.    
  130.     local function trans(v,t)
  131.         for _,obj in pairs(char:GetDescendants()) do
  132.             if obj.Name ~= 'HumanoidRootPart' and (obj:IsA("Part") or obj:IsA("UnionOperation") or obj:IsA("BasePart") or obj:IsA("MeshPart") or obj:IsA("Texture") or obj:IsA("Decal")) then
  133.                 game:GetService("TweenService"):Create(obj,TweenInfo.new(t),{Transparency = v}):Play()
  134.             end
  135.         end
  136.     end
  137.  
  138.     local function fx()
  139.         local die = Instance.new("Sound")
  140.         die.SoundId = 'rbxassetid://147729146'
  141.         die.Volume = 5
  142.         die.Parent = torso
  143.         die.TimePosition = 3.8
  144.         die:Play()
  145.         trans(1,0.6)
  146.         wait(0.6)
  147.         trans(0,0.6)
  148.         wait(0.6)
  149.         char:BreakJoints()
  150.         shatter()
  151.     end
  152.    
  153.     hum.BreakJointsOnDeath = false
  154.     hum.Died:Connect(function()
  155.         hum.BreakJointsOnDeath = false
  156.         fx()
  157.     end)
  158. end
  159.  
  160. for _,plr in pairs(game:GetService("Players"):GetPlayers()) do
  161.     bind(plr.Character)
  162.     plr.CharacterAdded:Connect(function(char)
  163.         bind(char)
  164.     end)
  165. end
  166.  
  167. game:GetService("Players").PlayerAdded:Connect(function(plr)
  168.     plr.CharacterAdded:Connect(function(char)
  169.         bind(char)
  170.     end)
  171. end)
RAW Paste Data