Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix a camera on a part of a face ?

I want to make a 2 player 2D style game with a Surface Gui and Camera fixing for each player but im bad at camera manipulation i gave a try but it did not work :

local function LookAtFace(part, face, distance)
    face = face or Enum.NormalId.Front
    distance = distance or 10

    if (type(face) == "string") then
        face = Enum.NormalId[face] 
    end

    local position = part.Position
    local offset = part.CFrame:vectorToWorldSpace(Vector3.FromNormalId(face)) -- Gets the Vector3 from the face you put in and rotate it to world space

    workspace.CurrentCamera.CoordinateFrame = CFrame.new(position + distance*offset, position)
end

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable

LookAtFace(game.Workspace.GameGUI, "Front", 20) 

i put this script in workspace maybe its the problem

2 comments

0

You shouldn't put this in workspace because it has current camera in it and that has to be from a player 

0

i tried everywhere

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.