Make part always stay on a player's head

Hi, I have this script in my game that clones a part to the player’s head, but the part always stays on top of the players head.

Ideal result I want:

image

Server script:

local PartClone = AnklePart:Clone()
PartClone.CFrame = Head.CFrame
PartClone.Weld.Part0 = Head
PartClone.Weld.Part1 = PartClone
PartClone.Parent = Head
AlreadyCloned[Player] = true

Any help would be appreciated, thanks!

Update: found a way to position it how I want it to, but this is what happens to my character:

image

Script:

local PartClone = AnklePart:Clone()
--PartClone.CFrame = Head.CFrame
PartClone.Weld.Part0 = Head
PartClone.Weld.Part1 = PartClone
PartClone.Parent = Head
AlreadyCloned[Player] = true

What I would do is make the part an accessory then put it into the humanoid

i dont want to do that, I need the part so I can detect when it is touched

edit: tried it, still doesnt let me move, maybe its to do with the weld.

I just quickly made a script which prints when the hat is touched and it works for me

Ok thanks, but do I need the weld for the accessory, or will it automatically weld itself to the head?

Is the Part you are welding Anchored? That would keep your Avatar from moving.

it should automatically weld itself to the head

Have you looked into WeldConstraints? They’re simpler than the old weld object

Thank you, I removed the weld I made, and it automatically welded itself!

1 Like

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