Why isn't my script code working?

Why isn’t my script code working?
It is a code that I created with the help of the VERSE AI assistant.

The code basically works so that at the start of the game or island, it distributes L1 (gray) weapons. The default weapons are a shotgun, submachine gun, assault rifle, and sniper rifle (and mini-shield), occupying the five available spaces in the main inventory. These weapons would evolve in a predetermined order. From L1 to L3, the sequence is 5 eliminations, meaning that when you reach your first 5 eliminations, the shotgun changes to L2 (green), when you reach 10 eliminations, the submachine gun changes to L2 (green), and so on progressively for each weapon individually, up to L6 of the weapons mentioned, but when I test it on the island, the code does not work.

I should clarify that I am new to creating maps and have no idea which scripts to use. If anyone could help or guide me, I would be delighted to follow their advice and guidance.