Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local TweenService = game:GetService("TweenService")
- local RNG = Random.new()
- local node = Instance.new("Part")
- node.Name = "_ExplosionLightNode"
- node.Anchored = true
- node.CanCollide = false
- node.Locked = true
- node.Transparency = 1
- node.Parent = workspace
- local expFadeOut = { Brightness = 0, Range = 0, Color = Color3.new() }
- local expTweenOut = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
- local expTweenIn = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
- local function onExplosion(exp)
- local att = Instance.new("Attachment")
- att.Name = exp:GetFullName()
- att.CFrame = CFrame.new(exp.Position)
- local innerLight = Instance.new("PointLight")
- innerLight.Name = "InnerLight"
- innerLight.Brightness = expFadeOut.Brightness
- innerLight.Range = expFadeOut.Range
- innerLight.Color = expFadeOut.Color
- innerLight.Shadows = true
- local outerLight = innerLight:Clone()
- outerLight.Name = "OuterLight"
- local innerFadeIn =
- {
- Brightness = exp.BlastRadius * 30;
- Range = exp.BlastRadius * 1.5;
- Color = Color3.new(1,0.5,0.25);
- }
- local outerFadeIn =
- {
- Brightness = exp.BlastRadius * 2;
- Range = exp.BlastRadius * 3;
- Color = Color3.new(1,0.5,0.25);
- }
- innerLight.Parent = att
- outerLight.Parent = att
- att.Parent = node
- spawn(function ()
- while exp:IsDescendantOf(workspace) do
- local x = RNG:NextNumber(-1,1)
- local y = RNG:NextNumber(-1,1)
- local z = RNG:NextNumber(-1,1)
- att.CFrame = CFrame.new(exp.Position) * CFrame.new(x,y,z)
- RunService.Heartbeat:Wait()
- end
- end)
- local innerTweenIn = TweenService:Create(innerLight, expTweenIn, innerFadeIn)
- local outerTweenIn = TweenService:Create(outerLight, expTweenIn, outerFadeIn)
- innerTweenIn:Play()
- outerTweenIn:Play()
- wait(expTweenIn.Time)
- local innerTweenOut = TweenService:Create(innerLight, expTweenOut, expFadeOut)
- local outerTweenOut = TweenService:Create(outerLight, expTweenOut, expFadeOut)
- innerTweenOut:Play()
- outerTweenOut:Play()
- wait(expTweenOut.Time)
- att:Destroy()
- end
- local function onDescendantAdded(desc)
- if desc:IsA("Explosion") then
- onExplosion(desc)
- end
- end
- workspace.DescendantAdded:Connect(onDescendantAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement