How can I get StarterPlayer?

So I am trying to get the players accessory’s and put it in its starter character. But I don’t know how to put the character in the StarterPlayer. How can I get the StarterPlayer?

Here is my script:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		for i, v in pairs(char:GetChildren()) do
			if v:IsA("Accessory") then
				local StarterCharacter = script.StarterCharacter:Clone()
			end
		end
	end)
end)

Sincerely,

papahetfan

Just do game.StarterPlayer or game:GetService("StarterPlayer")

1 Like

I know what you’re trying to do but the problem is that it would happen that way for the other players, it’s better to change the player’s character and it would automatically be the new starting character

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		for i, v in pairs(char:GetChildren()) do
			if v:IsA("Accessory") then
				local StarterCharacter = script.StarterCharacter:Clone()
                               char = StarterCharacter
			end
		end
	end)
end)

I tested it and nothing happened.

Just use HumanoidDescription, get the Data from the Player, and then apply it to StarterCharacter.

Ok I looked and is there a way I can get all the accessories?

obviously wasn’t going to work was an example. what you need to do is make a startercharacter and then with HumanoidDescription get one by one each accessory and then add it to the character and add it as the player character

local StarterPlayer = game:GetService("StarterPlayer");
local StarterCharacter = StarterPlayer:WaitForChild("StarterCharacter");
-- assuming character appearance is loaded
for i,v in pairs(Character:GetChildren()) do
    if v:IsA("Accessory") then
        local AccessoryClone = v:Clone();
        v.Parent = StarterCharacter;
    end
end

You’d have to do this on the client, since StarterCharacter is meant for one model to be applied to everyone. I’m not even sure if it would work from the client, modifying your own StarterCharacter, since the loading of the character may be done on the server so the client changes probably won’t do anything.