Hello,
I’m writing a script that will get all the player accessories, move them to a dummy then make the player that dummy.
The script works all fine, but it doesn’t change the player to the dummy.
The script gives all the outputs; swap the accessories parent, write the line 22. But it doesn’t change character.
Script:
local Players = game.Players
local Starter = game.ReplicatedStorage.StarterCharacter
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(character)
task.wait(5)
local customCharacter = Starter:Clone()
customCharacter.Parent = workspace
for i, accessory in pairs(character:GetChildren()) do
if accessory:IsA("Accessory") then
print(accessory.Name) -- Optional (just checking)
accessory.Parent = customCharacter
end
end
task.wait(2.5)
character = customCharacter --This line seems to give nil? it does nothing
print("player avatar changed")
end)
end)
I tried searching around but found nothing