Camera CFrame problem

I have been trying to do a menu camera for 2 days but it always fail
here is my script

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
local com = workspace:FindFirstChild("cameraPart"):FindFirstChild("com")
game.ReplicatedStorage.Added.OnClientEvent:Connect(function(p)
repeat wait(0.1)
	cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable

	cam.CFrame = com.CFrame
end)

Here is the script i added to the ServerScriptService

game.Players.PlayerAdded:Connect(function(Plr)
	game.ReplicatedStorage.Added:FireClient(Plr)
end)
1 Like

I’m confused on why you got the server involved but if you set the cframe first it should set the camera cframe to the part properly

local camera = workspace.CurrentCamera
camera.CFrame = workspace:WaitForChild("Part").CFrame
camera.CameraType = Enum.CameraType.Scriptable
1 Like

I 've tried doing this but it doesn’t work

1 Like

Idk, it works perfectly for me. Make sure it looks exactly the same.

1 Like

try that and if its still not working.

  • Check If you have defined the camera properly
  • Make sure the Camera is anchored and isnt falling through the map every time.
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
local com = workspace:WaitForChild("cameraPart"):WaitForChild("com")

repeat wait(0.1)
	cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable

cam.CFrame = com.CFrame
1 Like

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