local Character = game.Players.LocalPlayer.Character
for i, v in pairs(Character:GetChildren()) do
if v:IsA("Part") then v.Material = Enum.Material.ForceField v.BrickColor.Name = BrickColor.new("Institutional white") elseif v:IsA("Hat") then local handle = v:WaitForChild("Handle") handle.Material = Enum.Material.ForceField handle.BrickColor.Name = BrickColor.new("Institutional white") end
end
That's the script I'm using for the code but it doesn't work.
Here's something you can do to ease the pain:
make a Script in StarterCharacterScripts (dont make it local)
local Char = script.Parent -- the script will clone in the character and will run when it is, so make the Char variable script.Parent, as it is parented to the Character. Char.ChildAdded:Connect(function(Child) -- this will run when a child is added into the Character. if Child:IsA("BasePart") then Child.Material = Enum.Material.ForceField Child.BrickColor = BrickColor.new("Institutional white") elseif Child:IsA("Accessory") then local Handle = Child:WaitForChild("Handle") Handle.Material = Enum.Material.ForceField Handle.BrickColor = BrickColor.new("Institutional white") end end)
When a child is added inside of the Character, this will run. And do the checks, and everything. One thing to note is just don't change the BrickColor's name to the color you want, just use BrickColor rather than BrickColor.Name. Mark this answer if it helped you!