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

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.)

Ad

Answer this question