I have tried making the Y rotation negative, but when i move fowards and backward it flips the key, and when I go left and right it works fine! Here is a video of it happening!
Maybe you can just asign the CFrame of the key to be relative to the head.
local HEIGHT = 2 --Make this the amount of studs you want the key to float above the players head
script.Parent.CFrame = hit.Parent.Head.CFrame * CFrame.Angles(0, 0, 0) + Vector3.new(0, HEIGHT, 0)
You’re gonna have to play around with the CFrame.Angles until it fits the orientation of your key but this should work.