Basically, this script worked well and fine in my test world, but after loading into a fresh world I got an error saying to turn player.addTag(all_tags[world.getTimeOfDay()]) into a string, so I did. Now I'm getting no errors but the script isn't working as intended. What it's meant to do is give players a different tag at different times of day, but from what I could tell it doesn't give the intended tags which are overtime_off and overtime_on. I'm not exactly sure where I went wrong.
const all_tags= {
}
all_tags[TimeOfDay.Day] = "overtime_off";
all_tags[TimeOfDay.Midnight] = "overtime_on";
all_tags[TimeOfDay.Night] = "overtime_on";
all_tags[TimeOfDay.Noon] = "overtime_off";
all_tags[TimeOfDay.Sunrise] = "overtime_off";
all_tags[TimeOfDay.Sunset] = "overtime_on";
system.runInterval(() => {
world.getPlayers().forEach(player => {
Object.values(all_tags).forEach(tag => {
player.removeTag(tag)
})
})
world.getPlayers().forEach(player => {
player.addTag(`${all_tags[world.getTimeOfDay()]}`)
})
}, 100)```
