Basicly what im trying to do is make it so that there is 6 different rooms and each room already has been coded all i need now is for the players camera to get locked to a different room and not the same room

heres what i got!

--FoundCam is a BoolValue only triggered when empty room is found

--RoomA,B,C,D,E,F1 is the actual room i coded! 

--i feel like for a,b in ipairs would be the fix! 
angle =math.rad(90)
while wait()  do 
	
	if game.Workspace.Room1.Value ~= true then
	game.Workspace.Room1.Value = true
	local target = workspace.RoomA1.Player.Head
	local camera = workspace.CurrentCamera
	camera.CameraSubject = target
	script.FoundCam.Value = true
	
	
		else if game.Workspace.Room2.Value ~= true then
	game.Workspace.Room2.Value = true
	local target = workspace.RoomB1.Player.Head
	local camera = workspace.CurrentCamera
	camera.CameraSubject = target
		
		
			else if game.Workspace.Room3.Value ~= true then
	game.Workspace.Room3.Value = true
	local target = workspace.RoomC1.Player.Head
	local camera = workspace.CurrentCamera
	camera.CameraSubject = target
			
			
			else	if game.Workspace.Room4.Value ~= true then
	game.Workspace.Room4.Value = true
	local target = workspace.RoomD1.Player.Head
	local camera = workspace.CurrentCamera
	camera.CameraSubject = target
				
				
				else	if game.Workspace.Room5.Value ~= true then
	game.Workspace.Room5.Value = true
	local target = workspace.RoomE1.Player.Head
	local camera = workspace.CurrentCamera
	camera.CameraSubject = target
					
					
					else	if game.Workspace.Room6.Value ~= true then
	game.Workspace.Room6.Value = true
	local target = workspace.RoomF1.Player.Head
	local camera = workspace.CurrentCamera
	camera.CameraSubject = target
					end
				end
			end
			end
		end
	end
	
if script.FoundCam.Value == true
	then
		camera.CoordinateFrame = CFrame.new(target.Position)
								  * CFrame.Angles(0,angle,0)
							     * CFrame.new(0,2,-3)
								
end


	
	

							
							
								

end

1 comment

0

If the Term "CurrentCamera" is changed, the Script would have to be a LocalScript and inside the player in the Player's PlayerGui