Help with Camera CFrame not changing

Everything in this script works fine, except the CFrame of the camera isn’t changing. When I change it manually while testing it works, but not here. (This is a LocalScript in StarterPlayerScripts)

local CurrentPositionX = 750

script.Create.Event:Connect(function (Item, Slot)
	CurrentPositionX += 20
	
	local Camera = Instance.new("Camera")
	Camera.Name = "Camera"
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = CFrame.new(Vector3.new(CurrentPositionX, 1000, 100), Vector3.new(CurrentPositionX, 1000, 100))
	Camera.Parent = Slot
	
	print(tostring(Camera.CFrame))
	
	Item.CFrame = CFrame.new(Vector3.new(CurrentPositionX, 1000, 105), Vector3.new(CurrentPositionX + 5, 1000, 100))
	Item.Parent = Slot.ViewportFrame
	Slot.ViewportFrame.CurrentCamera = Camera
end)

Hi, have you disabled auto player spawning ?

No, what does that have to do with this?

I’ve already had this problem because I had deactivated the players autosoawn and I could not modify the camera until I had spawned the player at least once

This isn’t the Player’s camera, it’s a new camera. I’m using it for a viewportframe

I’m sorry, I’ve never worked with viewport frame cameras :confused: