So I have this script that runs when a player enters a game:

	repeat wait() until Player.Character
	wait(.5)
	getDefaultSkin(Player)

the code for the Default Skin function is:

function getDefaultSkin(Player)
	wait(.1)
	local Characters = Player.Character or Player.CharacterAdded:Wait()
	if game:GetService("Players"):FindFirstChild(Player.Name) and 			Player.Character.Humanoid.RigType == Enum.HumanoidRigType.R15 and 	   Player.Character.Humanoid.Health > 0 then        
	    Player:ClearCharacterAppearance()
		print("Destroyed")
	else
		print("Player Not Found")
	end
	wait(.1)
	Player.Character.UpperTorso.Color = Color3.fromRGB(58, 125, 21)
	Player.Character.LowerTorso.Color = Color3.fromRGB(58, 125, 21)
	Player.Character.LeftUpperLeg.Color = Color3.fromRGB(86, 66, 54)
	Player.Character.LeftLowerLeg.Color = Color3.fromRGB(86, 66, 54)
	Player.Character.RightUpperLeg.Color = Color3.fromRGB(86, 66, 54)
	Player.Character.RightLowerLeg.Color = Color3.fromRGB(86, 66, 54)
end

The problem is that it clears the player's appearance, but it doesn't change the colors of the player. This only happens when you are the first one in the server so the problem is probably something to do with the server startup, but I don't know how to change my function so that this works from the start

2 comments

0

dont use a repeat until loop for a player's character, use player.CharacterAdded:Wait()

0

that's in the actual function and was originally in the place of the loop. I changed it when I was just playing around trying to get it to work