Camera not working

for some odd reason the players camera won’t move to the parts position. Please help!

local Camera = game.Workspace.CurrentCamera
local campart = game.Workspace.CutsceneParts.CamPart2

script.Parent.Triggered:Connect(function(plr)
	repeat Camera.CameraType = Enum.CameraType.Scriptable wait() until Camera.CameraType == Enum.CameraType.Scriptable
	Camera.CFrame = campart.CFrame
	game.ReplicatedStorage.Door1Opened:Fire(plr)
	script.Parent.Parent.UnlockSFX:Play()
	wait(.817)
	game.Debris:AddItem(script.Parent.Parent.Parent, .1)
end)
2 Likes

Hey! Are you able to provide any errors?

1 Like

Try this

local Camera = game.Workspace.CurrentCamera
local campart = game.Workspace.CutsceneParts.CamPart2

script.Parent.Triggered:Connect(function(plr)
    -- Ensure camera is in Scriptable mode
    Camera.CameraType = Enum.CameraType.Scriptable
    Camera.CameraSubject = nil -- Set CameraSubject to nil or the specific part
    -- Wait a moment to ensure the camera is ready to move
    wait(0.1)
    -- Move camera to the desired part's position
    Camera.CFrame = campart.CFrame
    -- Play the necessary effects and trigger events
    game.ReplicatedStorage.Door1Opened:Fire(plr)
    script.Parent.Parent.UnlockSFX:Play()
    -- Wait for the sound or other effects to finish
    wait(.817)
    -- Clean up the object after the cutscene
    game.Debris:AddItem(script.Parent.Parent.Parent, .1)
end)

Ensure this is a LocalScript in StarterPlayerScripts or StarterCharacterScripts or Gui in StarterGui

I can’t provide any errors because the output is clean.

I’ll try it! Thanks for the help!

Edit: all so I tried it, for some odd reason it still doesn’t work. It may be bc I modified it that way I could put it in starterplayerscripts

Please ensure it’s either in startergui, characterscripts or playerscripts.

For testing purposes (Because I don’t know your full setup or intentions) I have isolated the camera portion of the script and was able to verify it will indeed work. Script was in StarterPlayerScripts for testing

local Camera = workspace.CurrentCamera
local campart = workspace.CutsceneParts:WaitForChild("CamPart2")


	-- Ensure camera is in Scriptable mode
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CameraSubject = nil -- Set CameraSubject to nil or the specific part
	-- Wait a moment to ensure the camera is ready to move
	wait(0.1)
	-- Move camera to the desired part's position
	Camera.CFrame = campart.CFrame
	-- Play the necessary effects and trigger events
	--game.ReplicatedStorage.Door1Opened:Fire(plr)
	--script.Parent.Parent.UnlockSFX:Play()
	-- Wait for the sound or other effects to finish
	--wait(.817)
	-- Clean up the object after the cutscene
	--game.Debris:AddItem(script.Parent.Parent.Parent, .1)

Hmmmm, maybe it’s a studio issue. It also might be because the camera changes after an event is fired, the camera might not work like that. Idk, I have been having a lot of problem with bugless scripts lately

Edit: it is most likely a problem with the event. As I tested it without the event(that way the camera doesn’t have to wait before changing) and it works fine. But one thing I do know is the the event does 100% fire, as other scripts that interpret the same event work. It’s just an issue with this specific script.

It’s inside of playerscrpipts currently. Thanks for reminding me though!