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)