StatusEffectManager | Create status effects with server-client architecture easily!

Github Download / Documentation: Link
uses MIT license

Wanted a module which allowed you to easily apply, create, and remove status effects, but couldn’t find any? This OOP module allows you to do so with ease!

Effect example:

local statusManager = require(game.ReplicatedStorage.pathto.StatusEffectManager)
local MyEffect = statusManager.RegisterEffect()
MyEffect.Name = "Test"

function MyEffect:OnStart()
	task.wait(6)
	self.Destroyed:Once(function()
		print("works to detect end")
		print(self.Character) --you
	end)
	--automatically ends
	task.wait(35)
	--too long, collected after 30 seconds with max lifetime.
end
function MyEffect:OnStop()
	print("works too")
end
return MyEffect

How I use it in my game:

It also has extra features, such as detecting if in combat or the last killed character, but this requires the combatchanged / lastkilledchanged signal to be fired in your damage module (same with damage tracking signals). You can remove these if you want.

This is my first resource, cut me some slack if the module isn’t that good! It was originally only supposed to be used in my game that has 0 players lol.
also give feedback please! thanks.
9 Likes

How could you implement this for maybe a speed boost? Like would it stack? Would it know the original speed the player was at before any buffs were applied?
(Either way amazing system!)

Please round your damage numbers

Seems interesting but I don’t a hundred percent understand, is it just a library module for effects? What would make me want to use this over other effect modules?

Also can you please put a Roblox download link

1 Like

Yes, effects stack by default, but it requires you to implement your own logic for stacked effects, for example:

self.Character.Humanoid.WalkSpeed+=8

self.Destroyed:Once(function()
    self.Character.Humanoid.WalkSpeed-=8
end)

You can also disable stacking by simply doing something like if #characterMap:GetEffectsFromDiscriminator(effect)<1 then characterMap:AddEffect(effect) end in your code

It’s an old game.

Well, no. You have to create the effects. The effects (modules) are technically the libraries. StatusEffectManager allows you to add and remove them to/from characters.

Well, I don’t actually see many status effect modules. There’s Effectify, but it’s way too verbose. StatusEffectManager is much simpler; you add effects, check if there are effects, and you remove effects.

Here’s an example on how to create a fire effect on effectify:

local TypeCheck = require(script.Parent.TypeCheck)
local ParticleHandler = require(script.Parent.ParticleHandler)

return {
	Fire = {
		Duration = 3,
		Interval = 1,
		CanStack = true,
		Function = function(Params: TypeCheck.Properties)
			local damage = 5

			Params.ActivatedSignal:Connect(function(callback)
				local particleTable = ParticleHandler.Attach(Params, "Fire")
				callback(particleTable)
			end)

			Params.DeactivatedSignal:Connect(function()
				if Params.Particles then
					ParticleHandler.Detach(Params)
					Params.Particles = nil
				end
			end)

			Params.TickSignal:Connect(function()
				local hum = Params.Owner:FindFirstChildOfClass("Humanoid")
				if hum then
					hum:TakeDamage(damage)
				end
			end)
		end,
	}
}

Now here it is on StatusEffectManager

local statusManager = require(game.ReplicatedStorage.pathto.StatusEffectManager)
local FireEffect = statusManager.RegisterEffect()
FireEffect.Name = "Fire"

function FireEffect:OnStart()
	local particle = game.ReplicatedStorage.FireParticle:Clone()
    particle.Parent=self.Character.PrimaryPart
    particle.Enabled=true
	self.Destroyed:Once(function()
        particle:Destroy()
	end)
    for i=1,10 do --iteration automatically stops when removed from a character
        self.Character.Humanoid:TakeDamage(3)
        task.wait(1)
    end
end
return FireEffect

See, a lot simpler.

Strangely, roblox won’t allow me, but I can give you the rbxm.
StatusEffectManager.rbxm (11.1 KB)

Brand new update (now game ready)!

1.1.0 is released!

Changelog in short:

  • typecheck fixes
  • full varargs support for effect:OnStart()
  • EffectRemoved / EffectAdded on client finally returns the actual effect tables (without the functions of course). i tried before but i had a cyclic error somehow but I got it working now.

There are also extra features, such as getting the last killed character, detecting if character is in combat, checking if many effects of same discriminator / name are active on a character, and more.

FYI: Client functionality isn’t necessary, just don’t do .newClient() on local script if you don’t want it.

Check out github for release (rbxm is also there)
Release v1.1.0 · WBlair1/StatusEffectManager

Any fixes needed or bugs feel free to report

boiiii…

kakarot kakarot char char (30)

Thanks for sharing this, it honestly seems great, I’ll come back if i have any suggestions

1 Like