Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Accessories aren't attaching to the player?

Asked by 6 years ago
Edited 6 years ago

I'm making a Character Customization script. Everything works fine and all except for the fact that the hair doesn't attach to the dummy character in the game properly.

I'm using the following code to attach the hair to the dummy: (Note. I'm using Accessories with Attachments in them)

--Local Script

--Cloning the hair from ReplicatedStorage
local new = hair:Clone()
--Finding and destroying the old hair
for _, part in pairs(Dummy:GetChildren()) do
    if part.Name == 'HairA' then
        part:Destroy()
    end
end
new.Name = 'HairA'
--Parenting the hair to the Dummy
new.Parent = Dummy

This code works fine in Solo Play but breaks whenever I try it in a server test it seems to break. The hair also has the proper HairAttachment in it's handle. There aren't any errors in the output either.

Gif of the Issue: https://i.imgur.com/j7YB6V9.gifv

Is it because it's in a local script? If so why?

Edit: Should probably also mention that the dummy I'm using to show off the character is a local part inside a camera.

Edit: Ok so it turns out it was because the dummy was inside a camera it was breaking so I've placed it in the workspace and it works fine. If you know how to get it working with local parts that would be great though. For now I'll just set the place to 1 player.

Thanks for the help, Rayinator.

0
local script do not work with cloning welds LegosAreGood05 -2 — 6y
0
I don't quite understand. I'm using accessories and attachments not welds. Rayinator 0 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Try setting the position

--Local Script

--Cloning the hair from ReplicatedStorage
local new = hair:Clone()
--Finding and destroying the old hair
for _, part in pairs(Dummy:GetChildren()) do
    if part.Name == 'HairA' then
        part:Destroy()
    end
end
new.Name = 'HairA'
--Parenting the hair to the Dummy
new.Parent = Dummy
new.Position = Vector3.new(0, 0, 0) -- Change this to the position you need
0
Good answer magicguy78942 238 — 6y
0
I've tried setting the position of the hair but it doesn't seem to work. I'm using accessories and attachments to insert the accessories. Should I be using parts and welds instead? Rayinator 0 — 6y
0
Not sure but its worth a try MasonTheCreeperYT3 74 — 6y
Ad

Answer this question