Roblox accessory placement

  1. What do you want to achieve? the accessories to be placed in the right place and not behind the camera

  2. What is the issue?

  3. What solutions have you tried so far? humanoid:AddAccessory and accessory.Parent

	elseif Object:IsA('Accessory') then
		--Check if the accessory is already in CharacterClothing.Accesories
		if AccessorySelected(Object) then
			--If true then destroy the accessory
			local CharacterObject = GetCharacterAccessory(Object)
			if CharacterObject then
				local TableIndex = GetAccessoryTableIndex(Object, CharacterObject)
				CharacterObject:Destroy()
				if TableIndex ~= -1 then
					table.remove(CharacterClothing.AccesoryObject, TableIndex)
				end
			end
		else 
			--Else add an accessory
			local Clone = Object:Clone()
			table.insert(CharacterClothing.AccesoryObject, CData(Object:GetAttribute('Id'), Button, Clone, Object))
			Clone.Parent = Character
		end
	end

Full code: --Serviceslocal ReplicatedStorage = game:GetService('ReplicatedStorage')loca - Pastebin.com

1 Like

I’m wondering if the Pivot of the hair is out of place.
Is this something that you’ve created?

If it’s in replicated storage then drag it in the Explorer window and place it in the Workspace. Use your Move tool to show you where the Pivot of the hair is. If the move tool handles are not aligned to about the center of the hair you’ll need to reset it, but if that happens you’ll probably have to manually Edit the Pivot again to get the hair aligned properly to your head.

i guess the pivot is okay and when i put it on a dummy it looks okay too

1 Like

maybe it could be the pivot of the dummy

        --this is what im doing to rotate the dummy
		MouseDelta = if HoldingDown then MouseDelta:Lerp(GetMouseDelta(), 0.5) else MouseDelta:Lerp(Vector2.zero, 0.25)
		--Pivot the character to MouseDelta and set the LastCharacterCFrame to new one
		local MouseX = math.rad(MouseDelta.X * RotateSens)
		Character:PivotTo(LastCharCFrame * CFrame.Angles(0, MouseX, 0))
		LastCharCFrame = Character:GetPivot()
1 Like

fixed it, i was using viewport frames which broke the attachments
i’ve used this function

local function AddAccessory(Accessory)
	local Attachment = Accessory.Handle:FindFirstChildOfClass("Attachment")
	local Weld = Instance.new("Weld")
	Weld.Name = "AccessoryWeld"
	Weld.Part0 = Accessory.Handle
	if Attachment then
		local other = Character:FindFirstChild(tostring(Attachment), true)
		Weld.C0 = Attachment.CFrame
		Weld.C1 = other.CFrame
		Weld.Part1 = other.Parent
	else
		Weld.C1 = CFrame.new(0, Character.Head.Size.Y / 2, 0) * Accessory.AttachmentPoint:inverse()
		Weld.Part1 = Character.Head
	end
	Accessory.Handle.CFrame = Weld.Part1.CFrame * Weld.C1 * Weld.C0:inverse()
	Accessory.Parent = Character
	Weld.Parent = Accessory.Handle
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.