How do I detach a sword from player's skeleton

If the character uses all one material, then you can’t put a material on just a single part of it without applying the material to the whole thing.

Another thing you could try though is checking if the weapon is a separate bone on the skeleton. If it is, you can use Hide Bone By Name node on begin play.