SG Effects | Script Generated Effects

SGEffects | Script Generated Effects.

Introducing SG Effects, SG Effects is a ModuleScript for creating, building, customizing, and managing effects easily that are created by this script. The effects run mostly on TweenService for control and customizability, there are also some non-tween based effects that use an RBXScriptConnection.

Examples:

Simple Script Example
local SGEffects = require(script.SGEffects)

local Part = Instance.new("Part")
Part.Position = Vector3.new(-0.71, 95.387, -0.72)
Part.Anchored = true
Part.Parent = workspace

task.wait(1)

for i = 1, 50 do
	local Clone = Part:Clone()
	Clone.Parent = workspace
	local SO = SGEffects:ScatterOut(Clone)
	local SF = SGEffects:SizeFactor(Clone)
	SO:Play()
	SF:Play()
end
Part:Destroy()

Result:

USXll1r31Z

Complex Script Example
local SGEffects = require(script.SGEffects)
SGEffects.Autoplay = true

local Part = Instance.new("Part")
Part.Position = Vector3.new(-0.71, 95.387, -0.72)
Part.Anchored = true
Part.Parent = workspace

task.wait(2)

local Parts = {}
local Effects = 30
for i = 1, Effects do
	local Clone = Part:Clone()
	Clone.Name = "Effect"
	Clone.Parent = workspace
	table.insert(Parts, Clone)
end
Part:Destroy()

for i,v in next, Parts do
	local ScatterOut = SGEffects:ScatterOut(v, nil, {-23, 23}, 1.5)
	local SizeOut = SGEffects:SizeFactor(v, nil, 1.5 + 1.0)
	if i == #Parts then
		SizeOut.Completed:Wait()
	end
end
for i = 1, #Parts do
	Parts[i]:Destroy()
end
Parts = {}

Result:

2ilhzuZ7HJ

Scenarios:

  • Fire Particles.

amLD7pvXbo

Fire Particles Code Example
local SGEffects = require(script.SGEffects)
SGEffects.Autoplay = true

local Colors = {
	BrickColor.new("Deep orange").Color,
	BrickColor.new("Yellow flip/flop").Color
}

local function FireParticle(CF)
	local Part = Instance.new("Part")
	Part.Anchored = true
	Part.Size = Vector3.new(0.562, 0.523, 0.53)
	Part.Color = Colors[math.random(1, #Colors)]
	Part.Material = Enum.Material.Neon
	Part.CFrame = CF
	Part.Parent = workspace
	
	return Part
end

local function Rnum(min, max)
	return Random.new():NextNumber(min, max)
end

while true do
	coroutine.resume(coroutine.create(function()
		local Particle = FireParticle(CFrame.new(-3, 0, 162))
		local Scatter = SGEffects:CompleteScatterOut(Particle, {-10, 35}, {8, 20}, {-10, 35}, nil, Rnum(0.5, 10))
		task.wait(0.30)
		local SizeOut = SGEffects:SizeFactor(Particle)
		SizeOut.Completed:Connect(function()
			Particle:Destroy()
		end)
	end))
	task.wait(Rnum(0.1, 0.45))
end
  • Custom Explosions.

oHnp91eBOS

Custom Explosion Code Example
local SGEffects = require(script.SGEffects)
SGEffects.Autoplay = true

local Part = Instance.new("Part")
Part.CFrame = CFrame.new(-12, 78, 156)
Part.Parent = workspace

local function CreateParticle(CF)
	local Part = Instance.new("Part")
	Part.Anchored = true
	Part.Material = Enum.Material.Glass
	Part.Size = Vector3.new(0.924, 0.879, 0.857)
	Part.CFrame = CF
	Part.Parent = workspace
	
	return Part
end

local Exploded = false
Part.Touched:Connect(function()
	if not Exploded then
		Exploded = true
		Part:Destroy()
		for i = 1, 5 do
			local Expl = Instance.new("Explosion")
			Expl.Position = Part.Position
			Expl.Parent = workspace
		end
		for i = 1, 300 do -- Ik its not accurate!
			local Particle = CreateParticle(Part.CFrame)
			SGEffects:ScatterOut(Particle, nil, {0, 80}, 0.4)
		end
	end
end)

task.wait(2)

Part.Anchored = false
  • A Solar System Simulation

YCKZAWLpci

Solar System Simulation Code Example
local SGEffects = require(script.SGEffects)
SGEffects.Autoplay = true

local function CreatePlanetOrStar(Color, Material, CF, Size)
	local Part = Instance.new("Part")
	Part.Anchored = true
	Part.Shape = Enum.PartType.Ball
	Part.Color = Color
	Part.Material = Material
	Part.CFrame = CF
	Part.Size = Size
	Part.Parent = workspace
	
	return Part
end

local Sun = CreatePlanetOrStar(BrickColor.new("Cool yellow").Color, Enum.Material.Neon, CFrame.new(-30, 25, 87), Vector3.new(4, 4, 4))
local Planets = 12
for i = 1, Planets do
	local NewPlanet = CreatePlanetOrStar(BrickColor.Random().Color, Enum.Material.SmoothPlastic, Sun.CFrame, Vector3.new(1.32, 1.32, 1.32))
	SGEffects.NonTweens:Orbit(NewPlanet, i * 5, i / 2)
end

And much more…


📜 Script:

Source | MainModule

Hope you enjoy the script! Or dislike it, feedback is always appreciated.

54 Likes

Great idea for a resource! I’ve been searching for an idea for the longest time so I could give something back… Very good idea though and seems useful! Have you run any benchmarks? From what I know these effects are usually pretty resource intensive!

1 Like

I have not ran any serious benchmarks but they seem to be pretty smooth until I reach past ~1000 effects running at once.

1 Like

damn,this module looks so cool.hope there arent any performance drops when using ALOT of particles,I loved the solar system simulation alot man

2 Likes

I agree, I’m also keen on about whether or not it will have a performance issue, or optimize this was made.

maybe list the functions that are usable

example

function1(aregument1,aregument2)–number,number

returns number
adds the numbers

function2(aregument1,aregument2)–string,string

returns string
concats the strings

1 Like

Noted, but you can also explore the module since it is open-source…

Yeah, I think he means put them in this post so we can quickly make a decision whether it’d be useful for someone’s situation, without having to go and get the module.

this thing is pretty cool. only thing is im worried about performance XD

Zamn,this module looks cool!Gotta check out the module! :+1: :+1: :+1: :+1: