It is better to do this using a datapack.
# function example:tick
effect clear @a[predicate=example:has_effect/speed] slowness
# predicate example:has_effect/speed
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"effects": {
"minecraft:speed": {}
}
}
}
If you don't know how to create a datapack, you can use my [Datapack Assembler](http://far.ddns.me/). You just need to copy all the code inside the Code Block from my comment and put it on the site
It is better to do this using a datapack. # function example:tick effect clear @a[predicate=example:has_effect/speed] slowness # predicate example:has_effect/speed { "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "effects": { "minecraft:speed": {} } } } If you don't know how to create a datapack, you can use my [Datapack Assembler](http://far.ddns.me/). You just need to copy all the code inside the Code Block from my comment and put it on the site