EDIT: I FOUND THE SOLUTION.
I have this script below which gives players a headband when clicking a TextButton
. Now, this script does work, however the headband is not rotated correctly when given to the player (like shown below). How can I adjust the script so this does not happen?
local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local newYearHeadband = Instance.new("Accessory")
newYearHeadband.Name = "Happy New Year Headband"
local handle = Instance.new("Part")
handle.Name = "Handle"
handle.Size = Vector3.new(1,1,1)
handle.Parent = newYearHeadband
local hatAttachment = Instance.new("Attachment")
hatAttachment.Name = "HatAttachment"
hatAttachment.Position = Vector3.new(0.015,-0.26,-0.024)
hatAttachment.Parent = handle
local mesh = Instance.new("SpecialMesh")
mesh.Name = "Mesh"
mesh.Scale = Vector3.new(1,1,1)
mesh.MeshId = "rbxassetid://8221877809"
mesh.TextureId = "rbxassetid://8221877926"
mesh.Parent = handle
local player = game.Players:GetPlayerFromCharacter(playerModel)
local button = player:WaitForChild("PlayerGui").ToolsUI.ContentFrame:WaitForChild("Headband")
button.MouseButton1Click:Connect(function()
humanoid:AddAccessory(newYearHeadband)
end)