Positioning accessories on player's head

I’m new to working with accessories so I don’t know how any of this works.
What I’m trying to do is fire a remote that will attach an accessory to the player’s head. It does successfully attach to the player’s head, however it is completely separated and I have no idea how to position it on the player’s head. Any help is appreciated

Code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fireEvent = ReplicatedStorage.HeadCameraInteractionRemotes:WaitForChild("HeadCameraPickup")
local HeadCamera = game.Workspace.HeadCamera

local event = ReplicatedStorage.HeadCameraInteractionRemotes:WaitForChild("HeadCameraPickup")
event.OnServerEvent:Connect(function(player, HeadCamera)
	HeadCamera.HeadCamera:Destroy()
	
	local changeProperties = game.Workspace.HeadCamera:GetChildren()
	for _,v in pairs(changeProperties) do
		if v:IsA("MeshPart") or v:IsA("Part") then
			v.Anchored = false
			v.CanCollide = true
		end
	end
	
	player.Character.Humanoid:AddAccessory(game.Workspace.HeadCamera)
	player.Character.HeadCamera.Parent = player.Character.Head
	
	
	player.Character.Head.HeadCamera.Core.equipSound:Play()
	
end)
1 Like

Don’t parent the Accessory to the player’s head, it will unattach from the player’s character.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fireEvent = ReplicatedStorage.HeadCameraInteractionRemotes:WaitForChild("HeadCameraPickup")
local HeadCamera = game.Workspace.HeadCamera

local event = ReplicatedStorage.HeadCameraInteractionRemotes:WaitForChild("HeadCameraPickup")
event.OnServerEvent:Connect(function(player, HeadCamera)
	HeadCamera.HeadCamera:Destroy()
	
	local changeProperties = game.Workspace.HeadCamera:GetChildren()
	for _,v in pairs(changeProperties) do
		if v:IsA("MeshPart") or v:IsA("Part") then
			v.Anchored = false
			v.CanCollide = true
		end
	end
	
	local accessory = workspace.HeadCamera
	
player.Character.Humanoid:AddAccessory(accessory)
	
	accessory.Core.equipSound:Play()
	
end)

Nvm, finally figured out how to do it

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