Script error minecraft?

Ra
3

I wrote a script and the most important thing is that you have join items, e.g. Compass.

But after a certain time, all items in the inventory code disappear:

on join:
set slot 0 player to diamond named "friends"

after a certain time, so to speak, the diamond disappears.

Fa

No code no answers. Give code

Sk

If I see that correctly, the complete code is already there.

Ra

No, but the rest of the codes work apart from that