How would I change this script so that the orientation is flipped?

I have a key that is backwards because of the orientation script, how do I flip it? This is the important part of my code.

script.Parent.Orientation = Vector3.new(0, hit.Parent.Head.Orientation.Y, -90)

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!

robloxapp-20230504-1655443.wmv (1.5 MB)

any help is appreciated!

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.

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