1 | |
2 | |
3 | |
4 | |
5 | getgenv().Time = 0.5 |
6 | |
7 | getgenv().Head = { |
8 | 1076256148, |
9 | 0000000000 |
10 | |
11 | } |
12 | |
13 | getgenv().Torso = { |
14 | 0000000000 |
15 | |
16 | } |
17 | |
18 | |
19 | |
20 | local function weldParts(part0, part1, c0, c1) |
21 | local weld = Instance.new("Weld") |
22 | weld.Part0 = part0 |
23 | weld.Part1 = part1 |
24 | weld.C0 = c0 |
25 | weld.C1 = c1 |
26 | weld.Parent = part0 |
27 | return weld |
28 | end |
29 | |
30 | local function findAttachment(rootPart, name) |
31 | for _, descendant in pairs(rootPart:GetDescendants()) do |
32 | if descendant:IsA("Attachment") and descendant.Name == name then |
33 | return descendant |
34 | end |
35 | end |
36 | end |
37 | |
38 | local function addAccessoryToCharacter(accessoryId, parentPart) |
39 | local accessory = game:GetObjects("rbxassetid://" .. tostring(accessoryId))[1] |
40 | local character = game.Players.LocalPlayer.Character |
41 | |
42 | accessory.Parent = game.Workspace |
43 | |
44 | local handle = accessory:FindFirstChild("Handle") |
45 | if handle then |
46 | local attachment = handle:FindFirstChildOfClass("Attachment") |
47 | if attachment then |
48 | local parentAttachment = findAttachment(parentPart, attachment.Name) |
49 | if parentAttachment then |
50 | weldParts(parentPart, handle, parentAttachment.CFrame, attachment.CFrame) |
51 | end |
52 | else |
53 | local parent = character:FindFirstChild(parentPart.Name) |
54 | if parent then |
55 | local attachmentPoint = accessory.AttachmentPoint |
56 | weldParts(parent, handle, CFrame.new(0, 0.5, 0), attachmentPoint.CFrame) |
57 | end |
58 | end |
59 | end |
60 | |
61 | accessory.Parent = game.Players.LocalPlayer.Character |
62 | end |
63 | |
64 | local function onCharacterAdded(character) |
65 | wait(getgenv().Time) |
66 | |
67 | for _, accessoryId in ipairs(getgenv().Head) do |
68 | addAccessoryToCharacter(accessoryId, character.Head) |
69 | end |
70 | |
71 | for _, accessoryId in ipairs(getgenv().Torso) do |
72 | addAccessoryToCharacter(accessoryId, character:FindFirstChild("UpperTorso") or character:FindFirstChild("Torso")) |
73 | end |
74 | end |
75 | |
76 | game.Players.LocalPlayer.CharacterAdded:Connect(onCharacterAdded) |
77 | |
78 | if game.Players.LocalPlayer.Character then |
79 | onCharacterAdded(game.Players.LocalPlayer.Character) |
80 | end |