Change all the material of character when joins

When player join all of part/specialmesh/mesh will be a specific material, like 3d adn 2d clothes, accessories, bodyparts like literally all itens of player

game.Players.PlayerAdded:Connect(function(player)
     player.CharacterAdded:Connect(function(character)
          for i,v in pairs(character:GetDescendants()) do 
               v.Material = MaterialYouWant
          end
     end)
end)

I should also note, make sure you check the class/type of instance v is by using:

 if v:IsA(" ") or v:IsA(" ") then
--Material Change here
3 Likes
  1. Where do i put the script in?
  2. at “MaterialYouWant” i just put the name of material or need put something more in?

– Also i just know a bit of scripting

For some reason it doesn’t work for most materials, although that’s a Roblox issue and not related to the code:

--Place inside game.StarterPlayer.StarterCharacterScripts

local function setModelMaterial(model: Model, material: Enum.Material)
	for _, v in pairs(model:GetDescendants()) do
		if v:IsA("BasePart") then v.Material = material end
	end
end

local character = script.Parent 

--example using the ForceField material
setModelMaterial(character, Enum.Material.ForceField)
1 Like

image
I wanted changed the material to do this effect (Character “respond” the light) to look a bit more realistic – also when player reset still changing the material

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.