Try Tynker's Mods Editor (Project > Create Project > Minecraft > Create Mod).
https://www.tynker.com/dashboard/student/#/minecraft/mod/bedrock
Use a block like this one to give the player an effect. Set the effect type, its duration (how long it lasts, in seconds), and the amplifier (a value from 1 to 5 that determines the strength of the effect).
You can also use the when player travels code block to trigger your program, so that your code only runs while the player travels in a particular method (for example, when sneaking, running, or flying):
Explore Tynker's Player Effects category for more coding ideas (Project > Create Project > Minecraft > Player Effects)
Or browse available courses for Tynker subscribers:
Browse Minecraft CoursesUpgrade for Ultimate Minecraft Access
Unlock the Full Minecraft Experience on Tynker!
GET STARTED FOR FREETYNKER LIVE CLASSES
Accelerate your child’s coding with Tynker’s expert guidance for personalized growth.
VIEW COURSES