Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to rotate part to face camera direction?

Asked by
x28_97 -9
4 years ago
Edited 4 years ago

I have a tool that makes a part that has a decal on it when the player clicks the mouse but the issues is that the part is always facing one direction and it never changes:

backup if image doesnt load: https://gyazo.com/0bd31f80bf70f483cf6190ef5a048a6e

so my mission is to make the part face upwards depending on where the player's camera is facing when the mouse was clicked like this:

backup if image doesnt load: https://gyazo.com/54d2e97b5cfd282256b14f9cd4a2ebe0

my code:

    local part = Instance.new("Part")
        part.Anchored = true
        part.CanCollide = false 
        part.Size = Vector3.new(7, 0.1, 7)
        part.Position = Vector3.new(0, 5, 0)
    part.Transparency=1
    part.CFrame = CFrame.new(position)
    part.Parent = workspace

Answer this question