1 | |
2 | |
3 | local Player = game.Players.LocalPlayer |
4 | local targetUserId = 2931004766 |
5 | local waitTime = 0.5 |
6 | |
7 | |
8 | local function addAccessoryToCharacter(accessory) |
9 | if not accessory:IsA("Accessory") then |
10 | warn("The provided object is not an accessory.") |
11 | return |
12 | end |
13 | |
14 | |
15 | accessory.Parent = workspace |
16 | |
17 | |
18 | wait(waitTime) |
19 | |
20 | |
21 | local character = Player.Character |
22 | local humanoid = character and character:FindFirstChildOfClass("Humanoid") |
23 | |
24 | if humanoid then |
25 | humanoid:AddAccessory(accessory) |
26 | else |
27 | warn("Humanoid not found in character.") |
28 | end |
29 | end |
30 | |
31 | |
32 | local function applyTargetHeadAccessories(character) |
33 | |
34 | local success, appearanceModel = pcall(function() |
35 | return game.Players:GetCharacterAppearanceAsync(targetUserId) |
36 | end) |
37 | |
38 | if not success then |
39 | warn("Failed to retrieve target's appearance.") |
40 | return |
41 | end |
42 | |
43 | |
44 | local head = character:FindFirstChild("Head") |
45 | if not head then |
46 | warn("Head part not found in character.") |
47 | return |
48 | end |
49 | |
50 | |
51 | for _, accessory in pairs(character:GetChildren()) do |
52 | if accessory:IsA("Accessory") and accessory.Parent == head then |
53 | accessory:Destroy() |
54 | end |
55 | end |
56 | |
57 | |
58 | for _, item in pairs(appearanceModel:GetChildren()) do |
59 | if item:IsA("Accessory") and item:FindFirstChild("Handle") then |
60 | local accessoryClone = item:Clone() |
61 | accessoryClone.Parent = workspace |
62 | wait(waitTime) |
63 | addAccessoryToCharacter(accessoryClone) |
64 | end |
65 | end |
66 | end |
67 | |
68 | |
69 | local function onCharacterAdded(character) |
70 | wait(waitTime) |
71 | applyTargetHeadAccessories(character) |
72 | end |
73 | |
74 | |
75 | Player.CharacterAdded:Connect(onCharacterAdded) |
76 | if Player.Character then |
77 | onCharacterAdded(Player.Character) |
78 | end |