No collide players

function NoCollidePeople()
    for _, ply in pairs(player.GetAll()) do
        ply:SetNoCollideWithTeammates( true )
hook.Add("PlayerInitialSpawn", "SetNocollide", NoCollidePeople)

This code isin’t working for me when I try to make people go through each other I put it in lua autorun server and it worked but then on restart it didint.

did you try loading the LUA file via console after restart?