Help Creating a Status-Effect(s) System

Hello, I want to create a system that would inflict status effects like poison, bleeding, etc. I don’t know where to start to make a system like this nor would I know how to make it optimized either. Any help with starting this will help.

For more information, I want to create something like what Minecraft has: Example Here

Thanks for your time!

1 Like

I could help you by saying what I used to make status effects.

I made preexisting NumberValue instances which are the status effects. There will be attacks that increase the .Value property of the NumberValue status effect instance. Then there’s code that will run if the value property is above 0.

This works for status effects that can’t stack up their time. For example, if you’re hit by 2 attacks that inflict 5s of bleed at the same time, they won’t be 10s.

1 Like

I’m sorry, but I’m confused on this

Would I make a table with something like this, and make a loop whenever a NumberValue instance is added to the player?

local Loops = {} --Holds the loop 
local StatusEffects = {
	
	[1] = function(...) --Poison
		
	end,
	
	[2] = function(...) --Bleeding
		
	end,
	
}

I made preexisting number value instances parented to the player, which are named the statuseffects.

The code in the attacks that apply them will simply just increase the number inside the numbervalue statuseffects instances.

There’s then separate code that handles what the effects actually do.

My code for example

(statuseffect module script)

The attacks will then call the modulescript and run that function.

(preexisting instance in a script called Setups)
image

1 Like
local Amount = 0
while Amount < 10 do --loops 10 times
    Amount += 1
    Character.Humanoid:TakeDamage(1)
    wait(1)
end

Why not use a for loop instead?

because this is ROBLOX not some old janky old 1982 C# _ <!5> * code for some unknown bank that doesn’t even know what AI is

…and because I sucked at scripting 2 YEARS AGO THIS WAS 2 YEARS AGO LET IT GO GAME JAM 1V1 ME!!!

1 Like

Please don’t ask questions like that for old topics like these :sob:
I totally forgot about this post until now.

For an answer for status effects, I can add a passive-coefficient to any stat that my game needs for a status effect to edit, as well as any functionality within a co-routine to run on both client and server.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.