This was written on a local script, but the server doesn't recognize this for all players in-game to see what it does. How can this be changed so it can work and be written in a server script, and is a RemoteEvent an absolutely necessary thing to use for this?
game.Players.LocalPlayer.CharacterAdded:connect(function() -- Head Color local Head = game.Players.LocalPlayer.Character:WaitForChild("Head") Head.BrickColor = BrickColor.new("New Yeller") -- Arms Destroyed local LeftUpperArm = game.Players.LocalPlayer.Character:WaitForChild("LeftUpperArm") LeftUpperArm:Destroy() local RightUpperArm = game.Players.LocalPlayer.Character:WaitForChild("RightUpperArm") RightUpperArm:Destroy() -- Sapling Limb Colors Set local UpperTorso = game.Players.LocalPlayer.Character:WaitForChild("UpperTorso") UpperTorso.BrickColor = BrickColor.new('New Yeller') local LowerTorso = game.Players.LocalPlayer.Character:WaitForChild("LowerTorso") LowerTorso.BrickColor = BrickColor.new('New Yeller') local LeftUpperLeg = game.Players.LocalPlayer.Character:WaitForChild("LeftUpperLeg") LeftUpperLeg.BrickColor = BrickColor.new('Bright yellow') local LeftLowerLeg = game.Players.LocalPlayer.Character:WaitForChild("LeftLowerLeg") LeftLowerLeg.BrickColor = BrickColor.new('Bright yellow') local LeftFoot = game.Players.LocalPlayer.Character:WaitForChild("LeftFoot") LeftFoot.BrickColor = BrickColor.new('Bright yellow') local RightUpperLeg = game.Players.LocalPlayer.Character:WaitForChild("RightUpperLeg") RightUpperLeg.BrickColor = BrickColor.new('Bright yellow') local RightLowerLeg = game.Players.LocalPlayer.Character:WaitForChild("RightLowerLeg") RightLowerLeg.BrickColor = BrickColor.new('Bright yellow') local RightFoot = game.Players.LocalPlayer.Character:WaitForChild("RightFoot") RightFoot.BrickColor = BrickColor.new('Bright yellow') -- Group Values Destroyed local plr = game.Players.LocalPlayer.Character local humanoidplr = game.Players.LocalPlayer for i, v in ipairs(plr:GetChildren()) do if v:IsA("Accessory") then v:Destroy() end end for i, v in ipairs(plr:GetChildren()) do if v:IsA("Shirt") then v:Destroy() end end for i, v in ipairs(plr:GetChildren()) do if v:IsA("Pants") then v:Destroy() end end end)
What this is doing: Editing a user's avatar upon them joining the game.
Hey Savvy,
You can use BodyColors to achieve this.
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:connect(function(Character) local bodyColors = Character:WaitForChild("Body Colors") -- Head Color bodyColors.HeadColor = BrickColor.new("Navy blue") -- Arms Destroyed local LeftUpperArm = Character:WaitForChild("LeftUpperArm") LeftUpperArm:Destroy() local RightUpperArm = Character:WaitForChild("RightUpperArm") RightUpperArm:Destroy() -- Sapling Limb Colors Set bodyColors.TorsoColor = BrickColor.new('New Yeller') bodyColors.LeftLegColor = BrickColor.new('Bright yellow') bodyColors.RightLegColor = BrickColor.new('Bright yellow') -- Group Values Destroyed Character.ChildAdded:Connect(function(child) wait(1) -- checks to see the type of the child, and if its one of the ones you want to delete then yeah if child:IsA("Accessory") then child:Destroy() elseif child:IsA("Shirt") then child:Destroy() elseif child:IsA("Pants") then child:Destroy() end end) end) end)
If you want to control the shirt or pants a player is wearing, as well as the color of their body parts, you should use a HumanoidDescription. The way it works is that you create it while in edit mode and change its properties so that they meet your desires. It'll let you change the color of each body part in its properties, as well as any shirts, pants, or accessories. You can apply the HumanoidDescription by calling the function ApplyDescription on their Humanoid, and passing in the HumanoidDescription.
This is in a server script:
local humanoidDescription = game.ServerStorage.HumanoidDescription game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local humanoid = character:FindFirstChildOfClass("Humanoid") if (humanoid) then wait() -- It'll error if you don't put a wait before using the function for some reason humanoid:ApplyDescription(humanoidDescription) for _, child in pairs(character:GetChildren()) do if (child:IsA("BasePart")) then if (string.find(child.Name, "Arm") or (string.find(child.Name, "Hand"))) then child:Destroy() end end end end end) end)
It listens for when a player joins the game, for when their character is added, and then applies the description to their Humanoid. It also destroys any arm pieces or hands.
Yeah you can you just need to change all the client variables (LocalPlayer, etc) and it should work fine. I recommend that you change it to a server-sided script so other players can see it and not just that single player.