i was making a menu gui for my game and used the camera's lookvector to tell how far i could move it (only left and right at the moment) and when i compare them (shown in script below) i get an error "Players.the8bitdude11.PlayerGui.LocalScript:8: attempt to compare two userdata values"

wait(2) -- because studio
leftMax = Vector3.new(-0.669129193, -0, -0.743146181)
rightMax = Vector3.new(0.669129193, -0, -0.743146181)
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = workspace.Part.CFrame
m = game.Players.LocalPlayer:GetMouse()
while wait() do
	if workspace.CurrentCamera.CFrame.LookVector > leftMax and workspace.CurrentCamera.CFrame.LookVector < rightMax then
		workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position, m.Hit.Position)
	end
end

3 comments

0

thank you

0

Comparing vectors with an inequality doesn't make sense, but what you can compare is their values on a single axis. LookVector.X > leftMax.X would work.