Hi, I was working at a Custom Camera that works with ViewPortFrames. But, this is my first time using ViewPortFrames. I created a code where you can move using WASD QE. It warns the correct CFrame, but the camera stays in the same way. This is the part who don’t work:

coroutine.wrap(function()
while true do
	if KeyHolding == true and type(Key) == 'string' then
		local X,Y,Z = 0,0,0
		if Key == "W" then
			Z = 0.1
		elseif Key == "A" then
			X = -0.1
		elseif Key == "S" then
			Z = -0.1
		elseif Key == "D" then
			X = 0.1
		elseif Key == "Q" then
			Y = -0.1
		elseif Key == "E" then
			Y = 0.1
		end
		Camera.CFrame = CFrame.new(Camera.CFrame.X+X,Camera.CFrame.Y+Y,Camera.CFrame.Z+Z)
		Reload()
		warn(Camera.CFrame)
	end
	wait(0.005)
end
end)()

The Camera’s CameraType is Scriptable.

3 comments

0

Why is your code written like that? It's pretty hard to read.

0

you should practice indentation, makes it easier to spot errors and easier for others to read

0

The problem is with this website, It isn't letting me putting my script.