How can i make an item effect that can be applied multipe times at once (not even for the same character)

i want to make code for a turn based effect that looks like this:

local turns = 0
local function effect()
-- effect starts here

if turns == 5 then
-- effect ends here
end

end

when the effect starts then the effect is applied and if it ends then it depletes but i don’t know how to make it work multiple times at once (aka work when the other effect with the same type is still going)

also it will be applied with a tool and i don’t know how to get around the replicated storage too

2 Likes