Camera script not working

Hi all
I was making a Hiding system for my horror game and when i was trying to change the Cframe of the camera it as not working.I Cant find anything wrong with it.Do you think it’s because the script is a serverscript?

The script:

local Prompt = script.Parent.ClosetDoor1.HidePrompt
local Dest = game.Workspace.ClosetHide
local cam = game.Workspace.CurrentCamera
local Cam1 = game.Workspace.ClosetCam2

Prompt.Triggered:Connect(function()
	for _, player in pairs(game.Players:children())do
		local char = player.Character
		char.HumanoidRootPart.CFrame = Dest.CFrame         
		char.HumanoidRootPart.Anchored = true
		cam.CameraType = Enum.CameraType.Scriptable
		cam.CFrame = Cam1.CFrame
	end	
end)

Thank You

Have you tried making it a local script?

Possibly, but most likely no. If you tween the camera on the server there will just be slight lag for most and terrible for some. I’d recommend making a localscript inside of StarterCharacterScripts and fire a remote to all clients, and in the ls you can change the camera type and the cframe there. Other than that I dont see what the issue is with your code, have you tried adding prints to see where the code breaks and checked output?

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