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

My camera script will not working properly, why isn't it working?

Basically I have a part called Cam. It has a working script that makes the player spectate an area in view of a brick. The part im failing at is that once you hit a text button within a frame within a gui called Team Change, you are supposed to go back to your normal camera view, but instead, the camera view does change at all. Something is not right with this script.. (THE CAMERA PART IS CALLED CAM)

local Player=game.Players.LocalPlayer
local Char=Player.Character or Player.CharacterAdded:Wait()
local camera=workspace.CurrentCamera

wait(0.1)
camera.CameraType=Enum.CameraType.Scriptable
camera.CFrame=workspace.Cam.CFrame

1 answer

✓ Accepted answer

try

local nCam = workspace.Cam 
camera.Position.CFrame = nCam.Position.CFrame.new(Vector3.new(nCam.Position))

Also, this will only work if Cam has a position. I made nCam just to save some space. If it doesn't work try taking out .new(Vector3.new(nCam.Position)

Hard to fix seen as I can't see your Cam script so I can figure out what we're working with (table, function, etc.)

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