Why will this script not work?
I’m trying to make a script were a player automatically gets a hat on their avatar.
However every time I join the script works but the hat doesn’t attach to the player.
I have inserted a attachment into the hat.
Here is the script:
local Rep = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Hat = Rep:WaitForChild("Hat")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Hat:Clone().Parent = Character
end)
end)
The code looks right. Is the attatchment actually attatched to the head? you could check if the hat is parented to the character if so there is a problem with the attachment and not the code
1.- is the mask parented to the character? that would be the first thing to check
2.- FaceCenter is inside the head so it would be easier to use FaceFront but its up to you
3.- is the mask an accesory? i haven’t tested this but when i attatch something to the player i always use an accesory object although im not 100% sure it has to be an accesory to work
i just copied your code and created a hat object with a part called “Handle” with an attatchment inside it called “FaceFrontAttatchment” and this is the result
this is how the hat looks like in the explorer